防止 WSE 引用的 System.Web.Services 的 .NET 程序集版本重定向
我有一个针对 .NET 4.0 框架的 ASP.NET 网站应用程序,并且该应用程序使用 WSE 3.0 (Microsoft.Web.Services3.dll) 公开一些 Web 服务以确保安全。当我使用该服务时,出现 SoapHeaderException: SOAP header Security was not Understanding 错误。当应用程序面向 .NET 2.0 时,我有一个非常相似的设置,运行正常,并且我比较了配置文件,没有发现任何差异。
使用 Reflector 我可以看到 Microsoft.Web.Services3.dll< /strong> 引用 System.Web.Services, Version=2.0.0.0 但当我使用 Fuslogvw.exe(程序集绑定日志查看器) 我看到在框架配置中找到版本重定向:2.0.0.0 重定向到 4.0.0.0< /strong>。我已经检查了各种机器级配置文件,并且没有明确引用重定向,因此我相当确定重定向是由于 Microsoft 发布商政策链接到程序集中。我尝试使用 publisherPolicy Element 使用配置来阻止此重定向如下所示,但似乎没有任何影响。我还尝试将publisherPolicy元素移到dependentAssembly元素之外,使其普遍适用,但这也没有帮助。
任何想法我做错了什么或替代方法来强制程序集绑定到程序集的特定版本?
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Services, Version=2.0.0.0" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<publisherPolicy apply="no" />
</dependentAssembly>
</assemblyBinding>
</runtime>
I've got an ASP.NET web site application targeting the .NET 4.0 Framework and the application exposes some web services using WSE 3.0 (Microsoft.Web.Services3.dll) for security. I'm getting a SoapHeaderException: SOAP header Security was not understood error when I consume the service. I have a very similar setup working OK when the application is targeting .NET 2.0 and I've compared the config files without identifying any differences.
Using Reflector I can see that Microsoft.Web.Services3.dll is referencing System.Web.Services, Version=2.0.0.0 but when I check the assembly binding using Fuslogvw.exe (Assembly Binding Log Viewer) I see Version redirect found in framework config: 2.0.0.0 redirected to 4.0.0.0. I've checked the various machine level config files and there is no explicit reference to a redirect so I'm fairly sure the redirect is due to a Microsoft Publisher Policy linked into the assemblies. I've tried to use the publisherPolicy Element to prevent this redirection using the config shown below but it does not seem to have any affect. I've also tried moving the publisherPolicy element outside the dependentAssembly element make it apply generally but that didn't help either.
Any ideas what I'm doing wrong or alternative ways to force the assembly bind to the specific version of the assembly?
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Services, Version=2.0.0.0" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<publisherPolicy apply="no" />
</dependentAssembly>
</assemblyBinding>
</runtime>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论