gpt4 book ai didi

asp.net - 基于microsoft/aspnet的Docker容器无法加载Kestrel

转载 作者:行者123 更新时间:2023-12-02 20:52:03 24 4
gpt4 key购买 nike

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

我的图像基于 microsoft/aspnet并添加了安装代码 node , npm , bowergrunt所以我可以在容器中构建应用程序。我知道我可能可以在将它添加到容器之前在客户端中构建它,但我想尝试一下。图像构建良好,但是当我启动容器时它找不到 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"
}

编辑:对您的 repo 进行了测试,并使其工作:)

关于asp.net - 基于microsoft/aspnet的Docker容器无法加载Kestrel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30268142/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com