我得到其中之一:
Could not load file or assembly 'System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
它继续:
=== Pre-bind state information ===
LOG: DisplayName = System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///D:/Websites/Reporting/2016-02-18.2/
LOG: Initial PrivatePath = D:\Websites\Reporting\2016-02-18.2\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Websites\Reporting\2016-02-18.2\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/reports/7733280c/d5adf208/System.Web.Mvc.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/reports/7733280c/d5adf208/System.Web.Mvc/System.Web.Mvc.DLL.
LOG: Attempting download of new URL file:///D:/Websites/Reporting/2016-02-18.2/bin/System.Web.Mvc.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
System.Web.Mvc 的正确版本位于 D:\Websites\Reporting\2016-02-18.2\bin 中。我整晚都在与这个项目作斗争,但我似乎无法解决这个问题。对于它的价值,我在 web.config 中也有绑定重定向。
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
我通常很擅长 dll 地狱类型的东西,但这让我感到困惑,因为据我所知,它似乎在告诉我它找不到位于 bin 目录中的文件并且是它正在寻找的版本为了。
我从这里去哪里?
编辑:我应该指出它在开发中运行良好,当我在开发机器上的某个地方部署项目时它也运行良好。但是当我部署到我们的登台服务器时,我得到了这个。不确定有什么不同。起初我确实遇到了一个问题,即 TFS 构建抓取了错误的 dll(即使我有 copy local = true 并且提示路径在那里它仍然抓取了不正确的版本,我不得不删除旧的 nuget 包文件夹以防止这种情况发生) . 我经常遇到这个错误,但这是我第一次得到它,当我检查它时文件实际上是正确的版本(并且双重、三重和四重检查它)。