我在 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
希望这可以帮助 :)
关于asp.net - 无法在 Ubuntu 上使用 `dnx run` 启动 ASP 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35395612/