如何使程序集重定向工作在.NET 4.0中的Web应用程序

编程入门 行业动态 更新时间:2024-10-22 23:43:58
本文介绍了如何使程序集重定向工作在.NET 4.0中的Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用asp 4.0基于Web的应用程序。

I am working on a web-based application using asp 4.0.

我有一些dll文件,我使用的GAC有一些嵌入式的依赖在旧的DLL。

I have some dlls I am using in the GAC that have some embedded dependencies on older dlls.

我已经配置的组件,使依赖重定向到该DLL的我的机器上正确的版本。这工作完全在3.5或更低版本的应用程序,但是,当我尝试基于相同的dll建立一个asp 4.0应用程序,它就像一个错误扼流圈:

I have Configured the assemblies so that the dependency redirects to the correct version of the dll on my machine. This works perfectly in a 3.5 or lower version application, however, when I try to build an asp 4.0 application based on the same dlls, it chokes with an error like:

Could not load file or assembly 'ControlReferencedByMyDll, Version=2.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXXX' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

在我的版本ControlReferencedByMyDll是2.0.1.0版本。

where my version of ControlReferencedByMyDll is version 2.0.1.0.

我无法找到.NET 4.0的GAC配置实用程序,但在我的machine.config(在这两个框架和Framework64文件夹.NET 4.0),我已经加入这样的:

I could not find a GAC configuration utility for 4.0, but in my machine.config (In both the Framework and Framework64 folders for 4.0) I have added something like:

<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="ControlReferencedByMyDll" PublicKeyToken="XXXXXXXXXXXXXXXX"/> <bindingRedirect oldVersion="1.0.0.0-9.9.9.9" newVersion="2.0.1.0"/> </dependentAssembly> </assemblyBinding> </runtime>

要查看是否这是问题。

to see if that was the problem.

我甚至试过了appliesTo =V2.0.50727属性添加到assemblyBinding,看它是否发挥了作用。

I've even tried to add the appliesTo="v2.0.50727" attribute to the assemblyBinding to see if it made a difference.

但它似乎并不具备。

任何人都有这个问题吗?更重要的是,任何人都可以帮我解决这个问题?

Has anyone else had this problem? and more importantly, can anyone help me solve this?

推荐答案

好了,我还没有看到任何额外的反馈意见,在这一点上,我还没有决定,如果/所在的config文件被机器之间的覆盖。配置和web.config文件,但这是什么工作。

Okay, I haven't seen any additional feedback, and at this point, I have not determined if/where the .config file is being overridden between machine.config and web.config, but this is what works.

我添加code类似以下内容:

I add code similar to the following:

<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="ControlReferencedByMyDll" PublicKeyToken="XXXXXXXXXXXXXXXX"/> <bindingRedirect oldVersion="1.0.0.0-9.9.9.9" newVersion="2.0.1.0"/> </dependentAssembly> </assemblyBinding> </runtime>

直接到我的web.config文件。

Directly to my web.config file.

我提出这是一个答案,我自己的问题,但如果你碰巧知道一个更好的办法,或者知道是什么引起的machine.config和web.config文件之间的脱节,请分享指示之前,

I am submitting this as an answer to my own question, but as indicated before, if you happen to know a better way, or know what's causing the disconnect between machine.config and web.config, please share.

感谢您

更多推荐

如何使程序集重定向工作在.NET 4.0中的Web应用程序

本文发布于:2023-11-12 11:56:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581439.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   重定向   程序   工作   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!