首先,回答这个问题,不要解决我的错误:
Upgrading WebGrease to version 1.3.0 gets me error
我的生产服务器上有以下绑定(bind)重定向:
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
我的生产服务器上有 Microsoft ASP.NET Web 优化框架所需的以下 DLL:
- System.Web.Optimization.dll 1.0.0.0(这不是预发行版本)
- Antlr3.Runtime.dll 3.3.1.7705
- Webgrease.dll 1.3.0.0
我收到以下错误:
Could not load file or assembly 'WebGrease, Version=1.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)
我已检查 GAC,我已删除所有临时 ASP.NET 文件夹,我已尝试删除 newVersion
我的配置中的属性 <bindingRedirect>
。我不确定是什么告诉 ASP.NET 寻找 WebGrease 1.0
最佳答案
终于弄清楚为什么这对我不起作用,尽管其他用户说这对他们有用。
我的 web.config 文件中有以下绑定(bind)重定向以强制 System.Web.Optimization
程序集以使用较新版本代替:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
这就像其他用户一样,但不起作用。然后我使用融合日志查看器(Fuslogvw.exe)找出更多信息,发现绑定(bind)过程甚至没有查看重定向指令。
最后发现根目录上一定不有 XML 命名空间...。如果我从我的 <configuration>
中删除以下内容它有效的元素:xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"
此外,只需确保您在 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
上指定了以下 XML 命名空间即可:元素。
终于!!
关于asp.net - 将 WebGrease 升级到版本 1.3.0 仅在生产服务器上导致错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16866676/