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

我尝试了asp.net 5的所有新function并logging下来,现在我遇到了第一个障碍。 我不能让我的代码在Docker容器中运行,我甚至不想让容器来听更改,我只是想让它运行。

我已经基于microsoft/aspnet我的形象,并添加代码来安装nodenpmbowergrunt所以我可以在容器中构build应用程序。 我知道我可能可以在客户端添加到容器之前创build它,但是我想尝试一下。 图像生成良好,但是当我启动容器时,找不到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 

凯斯特尔不应该已经存在,因为我基于microsoft/aspnet

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

微软/ aspnet基础镜像( https://github.com/aspnet/aspnet-docker/blob/master/1.0.0-beta4/Dockerfile )只给你运行Kestrel所需的最低发行版,包括dnvm和最新的dnx ,但不是Kestrel本身。 将Kestrel NuGet包添加到project.json中的依赖项,然后再次构builddocker镜像:

 "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" } 

编辑:你的回购testing,并使其工作:)