将我的ASP .net 5项目发布到IIS后,我收到了一个错误:
System.TypeLoadException:无法加载类型 程序集中的“Microsoft.AspNet.Builder.RequestDelegate” 'Microsoft.AspNet.Http.Abstractions'
根据一些帖子,似乎原因是包版本不同步。我检查了我的approot / packages文件夹,发现当我的网站使用rc1-final发布时,许多软件包的版本不正确(rc2)。我删除了这些包,因为还有正确的版本,但现在我收到以下错误:
System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path)
如何修复已发布的项目以解析为正确的版本?我在project.json中的所有引用都明确指向rc1-final。这是我的project.json中的我的依赖部分:
"dependencies": {
"Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.Core": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.ViewFeatures": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final",
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
"Microsoft.Net.Http": "2.2.22",
"Microsoft.Extensions.Configuration": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.Abstractions": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
"EntityFramework.Core": "7.0.0-rc1-final",
"EntityFramework.Commands": "7.0.0-rc1-final",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
"Sendgrid": "6.1.0",
"Sendgrid.Webhooks": "1.1.0",
"Microsoft.AspNet.SignalR.Server": "3.0.0-rc1-final",
"RabbitMQ.Client": "3.5.6"
},
答案 0 :(得分:0)
考虑到您正在引用SignalR,我想您不是标准的NuGet服务器而是CI构建。我认为你有不匹配的传递依赖(例如来自CI Build的Microsoft.AspNet.Http.Abstractions和来自nuget feed的Microsoft.AspNet.Http.Abstraction)。
尝试删除SignalR并切换到默认的nuget Feed,删除您的packages文件夹并恢复。它应该运行。
我认为是ASP.NET Core的架构师David Fowler曾经说过,你不应该混合使用不同的feed。那里什么都没有。