加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 将WebGrease升级到版本1.3.0仅在生产服务器上导致错

发布时间:2020-12-16 03:59:10 所属栏目:asp.Net 来源:网络整理
导读:首先,回答这个问题,不要解决我的错误: Upgrading WebGrease to version 1.3.0 gets me error 我的生产服务器上有以下bindingredirect: dependentAssembly assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" / bindi
首先,回答这个问题,不要解决我的错误:

Upgrading WebGrease to version 1.3.0 gets me error

我的生产服务器上有以下bindingredirect:

<dependentAssembly>
    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>

我在生产服务器上有以下DLL,它们是Microsoft ASP.NET Web Optimization Framework所必需的:

> System.Web.Optimization.dll 1.0.0.0(这不是预发布版本)
> Antlr3.Runtime.dll 3.3.1.7705
> Webgrease.dll 1.3.0.0

我收到以下错误:

无法加载文件或程序集’WebGrease,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35’或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配. (HRESULT异常:0x80131040)

我检查了GAC,我删除了所有Temporary ASP.NET文件夹,我尝试从我的配置< bindingRedirect>中删除newVersion属性.我不确定是什么告诉ASP.NET寻找WebGrease 1.0

解决方法

终于找到了为什么这对我不起作用,尽管其他用户说这对他们有效.

我在web.config文件中进行了以下绑定重定向,以强制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)来找出更多信息,并发现绑定过程甚至没有查看重定向指令.

最后发现根目录上一定不能有XML命名空间….如果我从< configuration>中删除以下内容它工作的元素:xmlns =“http://schemas.microsoft.com/.NetConfiguration/v2.0”

另外,只需确保在< assemblyBinding xmlns =“urn:schemas-microsoft-com:asm.v1”>上指定了以下XML命名空间:元件.

最后!!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读