asp.net - 无法在 Ubuntu 上使用 `dnx run` 启动 ASP 应用程序

标签 asp.net ubuntu mono dnx coreclr

我在 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/

相关文章:

c# - 为 ASP.NET 升级 Telerik RAD 控件

linux - 使用一个静态 IP 通过互联网在多个服务器之间进行通信

linux - CMake 获取 HOSTNAME 环境变量

c# - Mono/MonoTouch 下的 Task.Factory.StartNew() 延迟

.net - 为跨平台开源 UI 不可知 C# 类库选择哪种 Visual Studio 2017 项目类型,为什么?

c# - 如何在 .Net 3.5 框架中实现安全协议(protocol) TLS 1.2

asp.net - 从共享驱动器托管的网站中特定于服务器的 web.config

windows - 在 Windows 10 Bash 上安装 webpack(Windows 上的 Ubuntu 上的 Bash)。继续获取 "webpack: command not found"

mono - 构建 Mono 本身的 .deb 包

asp.net - jQuery 与 ASP.NET Ajax