净重定向请求组件,以不同的版本净重、组件、不同、版本

2023-09-07 16:32:51 作者:有气质的男生:断桥烟雨、浅唱离殇ミ

我有一个组件,它是1.0.0.0版本和新版本是2.0.0.0。两者都装在我的GAC。

I have an assembly that is version 1.0.0.0 and a new version that is 2.0.0.0. Both are installed in my GAC.

目前,我可以用配置的组件部分中的.NET Framework 2.0配置工具来强制执行1.0任何请求被发送到2.0组装我的服务器上。这仍然有效相同的4.0框架,但我需要安装德NET 2.0 SP1获得2.0配置工具。我相信你也能做到这一点与出版商政策,但这些似乎因为你要创建一个serparate组件来执行重定向到多一点的痛苦。

Currently I can use the "Configured Assemblies" section in the ".NET Framework 2.0 Configuration" tool to enforce that any requests for 1.0 are sent to the 2.0 assembly on my server. This still works the same with 4.0 framework but I need to install teh .Net 2.0 SP1 to get the 2.0 configuration tool. I believe you can also do this with "Publisher Policies" but these seem to be a bit more of a pain because you have to create a serparate assembly to perform the redirection.

使用正在向安全模型在.NET 4.0中,并认为,。NET Framework 2.0配置工具尚未安装在默认情况下,也没有更新,因为2.0我想知道的事实,其他的变化; 是有其他更preferred办法执行服务器范围重定向.NET程序集的某些要求的版本

With the other changes that are being made to the security model in .Net 4.0 and the fact that the ".NET Framework 2.0 Configuration" tool has not been installed by default nor updated since 2.0 I wanted to know; is there is any other more preferred way to enforce a server wide redirect for certain requested versions of a .Net assembly?

推荐答案

周杰伦,你可以做你需要在应用程序的配置文件(Web.config或app.config)中,也可位于机器的配置。我个人不会安装.NET 2.0 SP1的仅,以获取配置工具。

Jay you can do what you need in the app config file (web.config or app.config) or also in the machine config. I personally would not install .NET 2.0 SP1 only to get that configuration tool.

下面的例子来自:重定向大会版本

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="myAssembly"
          publicKeyToken="32ab4ba45e0a69a1"
          culture="en-us" />
        <!-- Assembly versions can be redirected in application, 
          publisher policy, or machine configuration files. -->
        <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
      <assemblyIdentity name="mySecondAssembly"
        publicKeyToken="32ab4ba45e0a69a1"
        culture="en-us" />
        <!-- Publisher policy can be set only in the application 
          configuration file. -->
        <publisherPolicy apply="no" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>