我的网站给出了......
无法加载文件或程序集'System.Web.Http,Version = 4.0.0.0, Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其中一个 依赖。定位程序集的清单定义没有 匹配程序集引用。 (HRESULT异常:0x80131040)
...然而在web.config中,我有......
<runtime xmlns="">
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
项目引用的System.Web.Http版本为5.2.3.0。
我想我之前添加了这个重定向来修复这个确切的问题,但现在它无法正常工作。有什么想法吗?
packages.config的内容......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AspNetMvc" version="4.0.20710.0" targetFramework="net4" />
<package id="CommonServiceLocator" version="1.3" targetFramework="net461" />
<package id="JsonValue" version="0.6.0" targetFramework="net4" />
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net461" />
<package id="Microsoft.AspNet.Razor" version="2.0.20715.0" targetFramework="net4" />
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebPages" version="2.0.20710.0" targetFramework="net4" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net4" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net461" />
<package id="Unity" version="4.0.1" targetFramework="net461" />
<package id="Unity.Mvc4" version="1.6.0.0" targetFramework="net461" />
<package id="Unity.WebAPI" version="5.2.3" targetFramework="net461" />
</packages>
答案 0 :(得分:0)
许多小时后,我发现此错误仅出现在我的默认路由上,并且只出现在我的开发机器上。它可能一直在做,我认为在重新检查代码之后发生了一些变化。
这是什么意思?