如何使发布商策略文件重定向组装请求 [英] How to make Publisher Policy file redirect assembly request

查看:119
本文介绍了如何使发布商策略文件重定向组装请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在工作中创建了一个公共库,它被安装在我们测试服务器上的GAC中。我最近更新了它,我希望我们所有的应用程序都使用更新。我创建了一个发布商策略程序集,并将其安装在GAC中以及更新,但是当Web应用程序加载Leggett.Common 1.0.0.0时,它不会重定向到Leggett.Common 1.1.0.0。

I have created a common library at work, and it is installed in the GAC on our test server. I've recently updated it and I want all of our applications to be using the update. I created a publisher policy assembly and installed it in the GAC along with the update, but when a web app loads Leggett.Common, 1.0.0.0, it isn't redirected to Leggett.Common, 1.1.0.0.

我有一个共同的程序集(实际上有五个,但是让它保持简单)在网络驱动器上,我创建了发布者策略xml文件旁边,然后使用al.exe在同一个文件夹中创建发布商策略程序集。之后,我将更新的程序集放在GAC中,然后将发布者策略程序集放在GAC中。

I have the common assembly (there are actually five, but lets keep it simple) on a network drive, I created the publisher policy xml file there next to it and then used al.exe to create the publisher policy assembly in the same folder. After that I put the updated assembly in the GAC and then put the publisher policy assembly in the GAC.

常见的程序集是Leggett.Common.dll,发布者策略文件为1.1.Leggett.Common.policy,发布商策略程序集为policy.1.1.Leggett.Common.dll。

The common assembly is 'Leggett.Common.dll', the publisher policy file is '1.1.Leggett.Common.policy', and the publisher policy assembly is 'policy.1.1.Leggett.Common.dll'.

发布商策略文件的XML如下所示:

The XML for the publisher policy file looks like the following:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="Leggett.Common"
                                  publicKeyToken="32cd8f1a53a4c744"
                                  culture="neutral" />
                <bindingRedirect oldVersion="1.0.0.0"
                                 newVersion="1.1.0.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

我做错了什么?

澄清

我在本地的开发机上测试这个,因为开发人员无法访问测试服务器。

Clarification
I'm testing this on my local dev machine since developers don't have access to the test server.

推荐答案

Ok ... at stab ...

Ok...at a stab...

1 - 尝试使用装配绑定日志查看器(Fuslogvw.exe),看看是什么装配绑定正在发生?

1 - have you tried using the Assembly Binding Log Viewer (Fuslogvw.exe) to see what assembly binding is taking place?

您可以在以下位置找到它:

You can find it in:

C:\Program Files\Microsoft SDK \Windows\v6.0A\Bin\FUSLOGVW.exe(安装了VS2008)。

C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\FUSLOGVW.exe (with VS2008 installed).

2 - 我有共同的程序集(实际上有五个,但是让它保持简单)在网络驱动器上, - 两个组件是否驻留在网络驱动器上?

2 - "I have the common assembly (there are actually five, but lets keep it simple) on a network drive," - Are both assemblies resident on the network drive?

更新: Ok ..如果新的程序集在网络驱动器上可能有一些信任问题。您可以将新的程序集部署到服务器上的本地驱动器,然后重新安装到GAC?

Update: Ok...if the new assembly is on a network drive there are probably some trust issues. Can you deploy the new assemblies to a local drive on the server then re-install to the GAC?

Update2:我知道...笨你肯定得到publicKeyToken和版本号正确吗?即新装配体的AssemblyVersion属性绝对是1.1.0.0,公钥令牌是相同的(在GAC中)?

Update2: I know..stupid stuff....you have definitely got the publicKeyToken and version number correct? i.e. Your AssemblyVersion attribute for the new assembly is definitely 1.1.0.0 and the public key token is identical (in the GAC)?

你尝试删除文化属性吗?

Have you tried removing the culture attribue?

Update3:您可以粘贴您使用的确切的发行商策略文件吗?另外请记住,如果要从1.0重定向到更高版本的程序集,则发布者策略名称必须使用要从其重定向的程序集的major.minor版本命名。所以在你的情况下,发布商策略应该被命名为policy.1.0.Leggett.Common.dll。我注意到你已经命名为policy.1.1.Leggett.Common.dll,这可能是它不起作用的原因。

Update3: Hi Max....Can you paste the exact publisher policy file you used? Also...remember that if you are redirecting from a 1.0 to a higher versioned assembly, the publisher policy name must be named using the major.minor version of the assembly you're redirecting from. So in your case the publisher policy should be named 'policy.1.0.Leggett.Common.dll'. I notice you've named it 'policy.1.1.Leggett.Common.dll' which may be the reason it's not working.

最后你必须确保你签署发布者策略与1.0和1.1程序集使用的密钥相同。

And finally you must make sure you sign the publisher policy with the same key as used by the 1.0 and 1.1 assemblies.

我构建了一些DLL,并将其放在GAC中,然后在VS中使用控制台应用程序测试,它的工作:)

I built a couple of DLL's and dropped them in the GAC then used a console app in VS to test and it does work :)

Update4: Hi Max,我从来没有想过。创建发布商策略文件时,是否指定了平台?尝试使用以下方式构建它:

Update4: Hi Max, something I never thought about. When you created the publisher policy file, did you specify the platform? Try building it with:

al /link:1.1.Leggett.Common.policy /out:policy.1.0.Leggett.Common.dll / keyfile:/version:1.0 .0.0

al /link:1.1.Leggett.Common.policy /out:policy.1.0.Leggett.Common.dll /keyfile: /version:1.0.0.0

退出/ platform切换并明确指定版本号。

Leave out the /platform switch and explicitly specify the version number.

干杯

Kev

Cheers
Kev

这篇关于如何使发布商策略文件重定向组装请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆