Unable to start ASP Application using `dnx run` on Ubuntu - asp.net

I am on Ubuntu 14.04
I have installed ASP using these instructions http://docs.asp.net/en/latest/getting-started/installing-on-linux.html#installing-on-ubuntu-14-04
Running dnvm list gives me the following:
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
* 1.0.0-rc1-update1 coreclr x64 linux default
1.0.0-rc1-update1 mono linux/osx
I then tried to create an ASP application using this tutorial:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-app-using-vscode/
However when I run dnx run I get the following error:
System.InvalidOperationException: IHostingBuilder.UseServer() is required for Start()
at Microsoft.AspNet.Hosting.Internal.HostingEngine.EnsureServer()
at Microsoft.AspNet.Hosting.Internal.HostingEngine.BuildApplication()
at Microsoft.AspNet.Hosting.Internal.HostingEngine.Start()
at Microsoft.AspNet.Hosting.WebApplication.Run(Type startupType, String[] args)
at ASPTutorial.Startup.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
at Microsoft.Dnx.ApplicationHost.Program.<>c__DisplayClass3_0.<ExecuteMain>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
A similar issue arises when I change from coreclr to mono.
UPDATE
dnx web works fine however!

The command to run with dnx is defined in the project.json in your project.
As mentioned in the comments, "run" is usually used for console applications and "web" is used for web applications. But you can write any command name you want in your project.jseon, even something like:
"commands": {
"runmyawesomeapp": "[...]"
}
And you can run it with
> dnx runmyawesomeapp
hope this helps :)

Related

Setting up .net site in IIS 8.5 (AWS)

My .net project (Any CPU) is referring to Oracle.dataaccess x86 version . In my local GAC the odac version is x86. But in the web server where it was installed previously was having AMB64 version of odac in GAC . The site was working without any problem . Now I need to move the site to AWS .The windows instance in AWS has the below configuration.
OS version : Microsoft windows server 2012 R2 Standard .
IIS 8.5
The server is clean and does not have any software installed .
When I try to create a site , I ended up seeing **could not load file or assembly one of its dependencies **. Through forums I installed various libraries from Oracle but I don't understand what are the exact steps needed . I was just doing trial and error.
Please let me know the software or steps to follow which needs do be installed such that my .net site which is connecting to its Oracle database works .
Edit 1 :
Hi ,
I performed the following steps .
As suggested by you I added Oracle.managedDataaccess dll(x86) . It worked well in my local.
Deployed the same code in the server.
I installed the oracle_12.1.0.1.0
In C:/oracle_12.1.0.1.0/odp.net/managed/x86 I ran the bat file for configuring the managed odac in the server. I was able to see the changes in the machine.config file .
5.Now when I ran the site I got the below error .
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. --->
System.TypeInitializationException: The type initializer for
'Oracle.DataAccess.Client.OracleClientFactory' threw an exception.
---> System.DllNotFoundException: Unable to load DLL 'OraOps12.dll': The specified module could not be found. (Exception from HRESULT:
0x8007007E) at
Oracle.DataAccess.Client.OpsInit.CheckVersionCompatibility(String
version) at Oracle.DataAccess.Client.OracleInit.Initialize() at
Oracle.DataAccess.Client.OracleClientFactory..cctor() --- End of
inner exception stack trace --- --- End of inner exception stack
trace --- at System.RuntimeFieldHandle.GetValue(RtFieldInfo field,
Object instance, RuntimeType fieldType, RuntimeType declaringType,
Boolean& domainInitialized) at
System.Reflection.RtFieldInfo.UnsafeGetValue(Object obj) at
System.Reflection.RtFieldInfo.GetValue(Object obj) at
System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow)
at
System.Data.Entity.Internal.LazyInternalConnection.CreateConnectionFromProviderName(String
providerInvariantName) at
System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings
appConfigConnection) at
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String
name, AppConfig config) at
System.Data.Entity.Internal.LazyInternalConnection.Initialize() at
System.Data.Entity.Internal.LazyInternalConnection.get_Connection()
at Sample.Data.AbstractEFUnitOfWork2.SetClientId(String clientId)
at Sample.Web.Controllers.ApiControllerBase1..ctor(IUow uow,
IConnectionManager cm, IEnumerable`1 allowedAppUserbases, String
connectionName, Boolean allowSaves)
In order to fix this I added OraOps12 dll from c:/oracle_12.1.0.1.0/bin to the wwwroot/site/bin folder. Then I got the below error .
System.ArgumentException: Unable to find the requested .Net Framework
Data Provider. It may not be installed. at
System.Data.Common.DbProviderFactories.GetFactory(String
providerInvariantName) at
System.Data.Entity.Internal.LazyInternalConnection.CreateConnectionFromProviderName(String
providerInvariantName) at
System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings
appConfigConnection) at
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String
name, AppConfig config) at
System.Data.Entity.Internal.LazyInternalConnection.Initialize() at
System.Data.Entity.Internal.LazyInternalConnection.get_Connection()
at Sample.Data.AbstractEFUnitOfWork2.SetClientId(String clientId)
at Sample.Web.Controllers.ApiControllerBase1..ctor(IUow uow,
IConnectionManager cm, IEnumerable`1 allowedAppUserbases, String
connectionName, Boolean allowSaves)
Checking to resolve this .
Appreciate your suggestions.

Adding migrations: System.MissingMethodException: Method not found ILibraryManager

Full error:
System.MissingMethodException: Method not found:
'Microsoft.Extensions.PlatformAbstractions.ILibraryManager
Microsoft.Extensions.PlatformAbstractions.PlatformServices.get_LibraryManager()'.
at Microsoft.Data.Entity.Commands.Program.ValidateProject(String
targetProject) at
Microsoft.Data.Entity.Commands.Program.<>c__DisplayClass2_7.b__15()
at
Microsoft.Dnx.Runtime.Common.CommandLine.CommandLineApplication.Execute(String[]
args) at Microsoft.Data.Entity.Commands.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly
assembly, String[] args, IServiceProvider serviceProvider) at
Microsoft.Dnx.ApplicationHost.Program.<>c__DisplayClass3_0.b__0()
at System.Threading.Tasks.Task`1.InnerInvoke() at
System.Threading.Tasks.Task.Execute()
Command that I try to run:
dnx ef migrations add test1
Version of EF commands:
Entity Framework Commands 7.0.0-rc1-16348
Version of dnx:
Microsoft .NET Execution environment Clr-x86-1.0.0-rc2-16595
My project currently use RC1. It all worked before.
Mostly sure the issue is the fact that you're mixing RC1 packages with RC2 runtime. Downgrade the runtime to RC1 or switch from dnx to dotnet and upgrade the packages to RC2

What are the valid DNX --watch flag values?

I'm working on my first ASP.NET 5 application. When trying to start the application from the command line by running:
dnx web --watch
I get the following output:
System.FormatException: Value for switch '--watch' is missing.
at Microsoft.Extensions.Configuration.CommandLine.CommandLineConfigurationProvider.Load()
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Add(IConfigurationProvider provider)
at Microsoft.AspNet.Hosting.WebApplication.Run(Type startupType, String[] args)
at Microsoft.AspNet.Server.Kestrel.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
at Microsoft.Dnx.ApplicationHost.Program.<>c__DisplayClass3_0.<ExecuteMain>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
What are the valid values for the --watch flag? I tried giving it a dummy value of 0 then changed some of my controller code, but the change was not reflected.
Update
To install dnx-watch run the following:
dnu commands install Microsoft.Dnx.Watcher
Then run your application by doing something like:
dnx-watch web
Arguments passed after the command name ("web" in your case) are arguments passed to that command. If you want arguments passed to DNX, pass them before: dnx --watch web
But, --watch will go away. Use dnx-watch instead: https://github.com/aspnet/Announcements/issues/74

ASP.NET VNEXT DNU Restore error

Every time I try to perform a package restore in visual studio, I get the error below. I also get the same error when using the samples from github with the command prompt i.e (
C:\Users\xxxxxx\Documents\GitHub\aspnet\samples\1.0.0-beta4\HelloMvc dnu restore)
I set my execution environment to use the following dnx -dnvm use 1.0.0-beta4 -r clr -arch x86 -p
I have tried deleting the packages from .dnx/packages and have tried replacing the runtimes, but nothing seems to work.
This may be a result of installing visual studio 2015 RC over the CTP 6; however, I have tried uninstalling and re-installing visual studio multiple times.
Any help would be appreciated.
Writing lock file C:\Users\xxxxxx\Documents\Visual Studio 2015\Projects\test3\src\test3\project.lock.json
----------
System.MissingMethodException: **Method not found: 'Newtonsoft.Json.Linq.JValue Newtonsoft.Json.Linq.JValue.CreateNull()'.**
at Microsoft.Framework.Runtime.DependencyManagement.LockFileFormat.WriteString(String item)
at Microsoft.Framework.Runtime.DependencyManagement.LockFileFormat.WriteArray[TItem](IEnumerable`1 items, Func`2 writeItem)
at Microsoft.Framework.Runtime.DependencyManagement.LockFileFormat.WriteProjectFileDependencyGroup(ProjectFileDependencyGroup frameworkInfo)
at Microsoft.Framework.Runtime.DependencyManagement.LockFileFormat.WriteObject[TItem](IEnumerable`1 items, Func`2 writeItem)
at Microsoft.Framework.Runtime.DependencyManagement.LockFileFormat.WriteLockFile(LockFile lockFile)
at Microsoft.Framework.Runtime.DependencyManagement.LockFileFormat.Write(Stream stream, LockFile lockFile)
at Microsoft.Framework.Runtime.DependencyManagement.LockFileFormat.Write(String filePath, LockFile lockFile)
at Microsoft.Framework.PackageManager.RestoreCommand.WriteLockFile(String projectLockFilePath, Project project, List`1 graphItems, PackageRepository repository, IEnumerable`1 frameworks)
at Microsoft.Framework.PackageManager.RestoreCommand.<RestoreForProject>d__74.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Framework.PackageManager.RestoreCommand.<>c__DisplayClass73_0.<<ExecuteCommand>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Framework.PackageManager.RestoreCommand.<ExecuteCommand>d__73.MoveNext()
----------
Restore failed
Method not found: 'Newtonsoft.Json.Linq.JValue Newtonsoft.Json.Linq.JValue.CreateNull()'.
Found the issue: Newtonsoft.json.dll verion 6.0.3 does not contain the CreateNull method. Added version 6.0.8 to the GAC and everything worked.

Remote execution of Coded UI Tests on a Windows XP VM

I have a Coded UI + SpecFlow test project (.NET Framework 4).
I want to perform remote test execution, so I configured a Visual Test Agent - Controller environment setup. My local machine is the Controller and there is a virtual machine which is the agent. The AUT will run on a Windows Embedded System with Windows XP SP3. The AUT is a WPF application.
VM properties:
Windows XP SP 3
Microsoft Test Agent 2012 is installed on the VM (Agents for Visual Studio 2012 Update 3)
The agent-controller communication is established successfully (Agent - Online, OK; Controller - Running, OK; TestSettings.testsettings - Configured, OK). The test execution is performed using mstest.
The following error is displayed when I execute the tests:
Test Name: CodedUITestMethod1
Test FullName: Remote.Test.CodedUITest1.CodedUITestMethod1
Test Source: c:\Users\user\Documents\Visual Studio 2012\Projects\Remote.Test\Remote.Test\CodedUITest1.cs : line 27
Test Outcome: Failed
Test Duration: 0:00:01.7131241
Result Message: Error calling Initialization method for test class Remote.Test.CodedUITest1: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A) ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
Result StackTrace:
--- End of inner exception stack trace ---
at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path)
at Microsoft.VisualStudio.TestTools.UITest.Framework.UITestExtensionPackageManager.LoadAssembly(String assemblyFile)
By definition Coded UI does not support Windows XP.
Is there a workaround for the upper mentioned issue? Any suggestions?
Thank you,
Isolation of Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser.dll from c:\Program Files\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages\ solved the problem. Action was performed on the remote VM.
The tests are up and running.

Resources