Yahya Uddin
Yahya Uddin

Reputation: 28841

Unable to start ASP Application using `dnx run` on Ubuntu

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!

Upvotes: 2

Views: 531

Answers (1)

Juergen Gutsch
Juergen Gutsch

Reputation: 1764

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 :)

Upvotes: 1

Related Questions