无法在Linux上运行vNext DNXCore 5应用程序

时间:2015-08-14 13:28:18

标签: ubuntu asp.net-core kestrel-http-server

我有一个DNXCore5应用程序,我一直非常小心,只针对DNXCore。无论如何,我可以用很少的步骤将它发布到Windows Server 2012 R2。我试图在Ubuntu中做同样的事情。我已经设置了我的环境并复制了我已发布的项目,我使用Kestrel作为Web服务器,因此它在Windows上与Linux相同。

我已经设置了dnvm并且安装了运行时的beta 5。然后,我将Visual Studio创建的可执行脚本脚本标记为

chmod + x kestrel

现在我无法按原样运行红场脚本,因为它尝试启动不存在的dnx的本地副本(由于某种原因)。

exec" $ DIR / approot / runtimes / dnx-coreclr-win-x64.1.0.0-beta5 / bin / dnx" --appbase" $ DNX_APPBASE" Microsoft.Framework.ApplicationHost kestrel" $ @"

所以我修改了最后一行,以便它读取,

dnx --appbase" $ DNX_APPBASE" Microsoft.Framework.ApplicationHost kestrel" $ @"

单独输入dnx表明它使用了正确的框架,因为我得到以下输出,

Microsoft .NET Execution environment Mono-x64-1.0.0-beta5-12103

Usage: dnx [options]

Options:
  --appbase <PATH>                 Application base directory path
  --lib <LIB_PATHS>                Paths used for library look-up
  --debug                          Waits for the debugger to attach before beginning execution.
  -?|-h|--help                     Show help information
  --version                        Show version information
  --watch                          Watch file changes
  --packages <PACKAGE_DIR>         Directory containing packages
  --configuration <CONFIGURATION>  The configuration to run under
  --port <PORT>                    The port to the compilation server

现在,当我通过./kestrel启动kestrel脚本时,我明白了,

System.InvalidOperationException: The current runtime target framework is not compatible with 'MyApp'.

Current runtime Target Framework: 'DNX,Version=v4.5.1 (dnx451)'
  Type: Mono
  Architecture: x64
  Version: 1.0.0-beta5-12103

Please make sure the runtime matches a framework specified in project.json
  at Microsoft.Framework.ApplicationHost.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
  at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute (System.Reflection.Assembly assembly, System.String[] args, IServiceProvider serviceProvider) [0x00000] in <filename unknown>:0
  at dnx.host.Bootstrapper.RunAsync (System.Collections.Generic.List`1 args, IRuntimeEnvironment env) [0x00000] in <filename unknown>:0

如果我在visual studio解决方案资源管理器中打开我的项目中的引用节点(web),我很难找到知道如何摆脱这个错误的人,我没有瞄准完整的框架应用程序和类库),它们都只有一个节点用于&#34; DNX Core 5.0&#34;,而且它们都在propject属性部分中定位它。我不知道它应该从哪里获得这个参考。我的project.json文件如下,

  "dependencies": {
  },

  "frameworks": {
    "dnxcore5": {
      "dependencies": {
        "System.Collections": "4.0.10-beta-23019",
        "System.Runtime": "4.0.20-beta-23019",
        "Microsoft.CSharp": "4.0.0-beta-23019"
      }
    }
  }

网络应用

  "dependencies": {
    "Microsoft.Framework.ConfigurationModel": "1.0.0-beta5",
    "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta5",
    "Microsoft.AspNet.Mvc": "6.0.0-beta5",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta5",
    "Microsoft.AspNet.StaticFiles": "1.0.0-beta5",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-beta5",
    "Microsoft.Framework.Configuration.Json": "1.0.0-beta5",
    "Microsoft.Framework.Logging": "1.0.0-beta5",
    "Microsoft.Framework.Logging.Console": "1.0.0-beta5",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta5",
    "Newtonsoft.Json": "7.0.1",
    "Microsoft.AspNet.Mvc.WebApiCompatShim": "6.0.0-beta5",
    "System.Security.Cryptography.DeriveBytes": "4.0.0-beta-23019",
    "MyLib": "1.0.0-*",
    "Kestrel":  "1.0.0-beta5"
  },

  "frameworks": {
    "dnxcore5": {
      "dependencies": {
        "System.Runtime.Extensions": "4.0.10-beta-23019",
        "System.Collections": "4.0.10-beta-23019",
        "System.Runtime": "4.0.20-beta-23019",
        "Microsoft.CSharp": "4.0.0-beta-23019",
        "System.Private.Networking": "4.0.0-beta-23109",
        "System.Net.Security": "4.0.0-beta-23109"
      }
    }
  },

我甚至确定我只是使用Kerstrel进行托管。有任何想法吗?我完全被卡住了。

0 个答案:

没有答案