尝试运行ASP.NET 5 Docker容器的异常
作者:互联网
尝试创建我的Docker容器.图像构建没有问题,但是当我尝试运行时:
docker run -t -d --name website website
我得到以下异常:
System.InvalidOperationException: Failed to resolve the following dependencies for target framework 'Asp.Net,Version=v5.0':
app 1.0.0
Microsoft.Framework.Logging.Interfaces 1.0.0-beta2
Searched Locations:
/{name}/project.json
/root/.kpm/packages/{name}/{version}/{name}.nuspec
/usr/lib/mono/4.5/{name}.dll
/usr/lib/mono/4.5/Facades/{name}.dll
Try running 'kpm restore'.
at Microsoft.Framework.Runtime.DefaultHost.GetEntryPoint (System.String applicationName) [0x00000] in <filename unknown>:0
at Microsoft.Framework.ApplicationHost.Program.ExecuteMain (Microsoft.Framework.Runtime.DefaultHost host, System.String applicationName, System.String[] args) [0x00000] in <filename unknown>:0
at Microsoft.Framework.ApplicationHost.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
看起来像是缺少的参考,但由于我包括Microsoft.AspNet.Hosting,所以肯定在project.json中对其进行了参考.
它建议运行kpm restore,但由于容器未运行而无法执行此操作.
有人看过类似的东西吗?
更新#1
好的,所以如果我添加了一个对Microsoft.Framework.Logging.Interfaces的明确引用,可以解决该问题,但我仍然留下了我不知道的应用程序1.0.0
更新#2
这是我的project.json:
{
"webroot": "wwwroot",
"dependencies": {
"Kestrel": "1.0.0-beta1",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta1",
"Microsoft.AspNet.Hosting": "1.0.0-beta1",
"Microsoft.AspNet.Mvc": "6.0.0-beta1",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta1",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0.0-beta1",
"System.Net.Http": "4.0.0-beta-22231"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5001",
"kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:5004"
},
"frameworks": {
"aspnetcore50": {
}
}
}
解决方法:
我相信问题是您正在尝试在CoreCLR(aspnetcore50)上运行.
由于您在Linux / Mono上运行,因此应该改为使用DesktopCLR(aspnet50).
标签:asp-net-core,docker,nuget,asp-net,linux 来源: https://codeday.me/bug/20191120/2045986.html