无法在 Ubuntu 上使用 `dnx 运行` 启动 ASP 应用程序
Unable to start ASP Application using `dnx run` on Ubuntu
我在 Ubuntu 14.04
我已经按照这些说明安装了 ASP http://docs.asp.net/en/latest/getting-started/installing-on-linux.html#installing-on-ubuntu-14-04
运行 dnvm list
给我以下内容:
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
* 1.0.0-rc1-update1 coreclr x64 linux default
1.0.0-rc1-update1 mono linux/osx
然后我尝试使用本教程创建一个 ASP 应用程序:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-app-using-vscode/
但是当我 运行 dnx run
我得到以下错误:
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()
当我从 coreclr
更改为 mono
时会出现类似的问题。
更新
dnx web
但是工作正常!
使用 dnx 到 运行 的命令在您项目的 project.json 中定义。
如评论中所述,"run"通常用于控制台应用程序,"web"用于Web应用程序。但是你可以在你的 project.jseon 中写任何你想要的命令名称,甚至是这样的:
"commands": {
"runmyawesomeapp": "[...]"
}
你可以 运行 它与
> dnx runmyawesomeapp
希望这对您有所帮助:)
我在 Ubuntu 14.04
我已经按照这些说明安装了 ASP http://docs.asp.net/en/latest/getting-started/installing-on-linux.html#installing-on-ubuntu-14-04
运行 dnvm list
给我以下内容:
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
* 1.0.0-rc1-update1 coreclr x64 linux default
1.0.0-rc1-update1 mono linux/osx
然后我尝试使用本教程创建一个 ASP 应用程序: https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-app-using-vscode/
但是当我 运行 dnx run
我得到以下错误:
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()
当我从 coreclr
更改为 mono
时会出现类似的问题。
更新
dnx web
但是工作正常!
使用 dnx 到 运行 的命令在您项目的 project.json 中定义。
如评论中所述,"run"通常用于控制台应用程序,"web"用于Web应用程序。但是你可以在你的 project.jseon 中写任何你想要的命令名称,甚至是这样的:
"commands": {
"runmyawesomeapp": "[...]"
}
你可以 运行 它与
> dnx runmyawesomeapp
希望这对您有所帮助:)