Docker 基于 microsoft/aspnet 的容器无法加载 Kestrel

Docker container based on microsoft/aspnet can't load Kestrel

我正在尝试 asp.net 5 的各种新功能并记录下来,现在我遇到了第一个障碍。我无法在 docker 容器中获取我的代码 运行,我什至没有尝试让容器监听更改,我只是想让它 运行.

我的图像基于 microsoft/aspnet 并添加了代码来安装 nodenpmbowergrunt,这样我就可以构建容器中的应用。我知道我可能可以在将它添加到容器之前在客户端中构建它,但我想试一试。图像构建良好,但是当我启动容器时它找不到 Kestrel.

System.IO.FileNotFoundException: Could not load file or assembly 'Kestrel' or one of its dependencies. The system cannot find the file specified.
File name: 'Kestrel'
  at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity) [0x00000] in <filename unknown>:0

  at (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName,System.Security.Policy.Evidence)
  at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName)
  at System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in <filename unknown>:0
  at Microsoft.AspNet.Hosting.Server.ServerLoader.LoadServerFactory (System.String serverFactoryIdentifier) [0x00000] in <filename unknown>:0
  at Microsoft.AspNet.Hosting.HostingEngine.EnsureServerFactory (Microsoft.AspNet.Hosting.HostingContext context) [0x00000] in <filename unknown>:0
  at Microsoft.AspNet.Hosting.HostingEngine.Start (Microsoft.AspNet.Hosting.HostingContext context) [0x00000] in <filename unknown>:0
  at Microsoft.AspNet.Hosting.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0

不应该 Kestrel 已经存在,因为我是基于 microsoft/aspnet 的吗?

我的 Dockerfile 的代码:https://github.com/mastoj/OneManBlog/blob/master/src/OneManBlog/Dockerfile

microsoft/aspnet 基础映像 (https://github.com/aspnet/aspnet-docker/blob/master/1.0.0-beta4/Dockerfile) 只为您提供 运行 Kestrel 所需的最小发行版,包括 dnvm 和最新的 dnx,但不包括 Kestrel 本身。将 Kestrel NuGet 包添加到 project.json 中的依赖项并再次构建 docker 映像:

"dependencies": {
    "Microsoft.AspNet.Mvc": "6.0.0-beta4",
    "Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
    "Microsoft.AspNet.StaticFiles": "1.0.0-beta4",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
    "Microsoft.AspNet.Hosting": "1.0.0-beta4",
    "Kestrel": "1.0.0-beta4"
}

编辑:对您的存储库进行了测试,结果成功了:)