代码之家  ›  专栏  ›  技术社区  ›  Martin Hollingsworth

阻止WSE引用的System.Web.Services的.NET程序集版本重定向

  •  3
  • Martin Hollingsworth  · 技术社区  · 15 年前

    我有一个ASP.NET网站应用程序,目标是 .NET 4.0版 为了安全起见,框架和应用程序使用WSE 3.0(Microsoft.web.Services3.dll)公开了一些web服务。我得到一个 SoapHeaderException:不理解SOAPHeader安全性 使用服务时出错。当应用程序以.NET2.0为目标时,我有一个非常相似的设置工作正常,并且我比较了配置文件,没有发现任何差异。

    使用 Reflector 我看得出来 Microsoft.Web.Services3.dll 正在引用 System.Web.Services,版本=2.0.0.0 但是当我使用 Fuslogvw.exe (Assembly Binding Log Viewer) 我懂了 在框架配置中找到版本重定向:2.0.0.0重定向到4.0.0.0 . 我已经检查了不同的机器级配置文件,并且没有显式地引用重定向,所以我很确定重定向是由于Microsoft Publisher Policy 链接到程序集。我试着用 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>
    
    0 回复  |  直到 15 年前
    推荐文章