【问题标题】:.NET assembly binding failure (different versions with a redirect), weird!.NET 程序集绑定失败(带有重定向的不同版本),很奇怪!
【发布时间】:2009-06-24 19:08:11
【问题描述】:

我正在尝试对安装了 9.3 版本的机器上针对供应商库的 9.1 版本构建的应用程序进行故障排除。供应商提供了一个发布者策略文件,该文件将所有版本从 9.0 开始重定向到他们的 9.3 dll,并安装在 GAC 中。

使用基于 9.2 版构建的较新版本的应用程序,可以找到发布者策略文件,并且一切正常。对于 9.1 链接版本,发布者策略文件根本不会在 fuslogvw 结果中提及。

这是从 fuslogvw 成功加载的示例:

LOG: This bind starts in default load context.
LOG: Using application configuration file: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe.Config
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Publisher policy file is found at C:\WINDOWS\assembly\GAC_MSIL\policy.9.2.ESRI.ArcGIS.System\9.3.0.1770__8fc3cc631e44ad86\ESRI.ArcGIS.System.config.
LOG: Publisher policy file redirect is found: 9.2.0.1324 redirected to 9.3.0.1770.
LOG: ProcessorArchitecture is locked to MSIL.
LOG: Post-policy reference: ESRI.ArcGIS.System, Version=9.3.0.1770, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86, processorArchitecture=MSIL
LOG: Found assembly by looking in the GAC.
LOG: Binding succeeds. Returns assembly from C:\WINDOWS\assembly\GAC_MSIL\ESRI.ArcGIS.System\9.3.0.1770__8fc3cc631e44ad86\ESRI.ArcGIS.System.dll.
LOG: Assembly is loaded in default load context.

而且,这里是失败的:

LOG: This bind starts in default load context.
LOG: Using application configuration file: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe.Config
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: ESRI.ArcGIS.System, Version=9.1.0.722, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Program Files/NatureServe/Vista/ESRI.ArcGIS.System.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/NatureServe/Vista/ESRI.ArcGIS.System/ESRI.ArcGIS.System.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/NatureServe/Vista/ESRI.ArcGIS.System.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/NatureServe/Vista/ESRI.ArcGIS.System/ESRI.ArcGIS.System.EXE.
LOG: All probing URLs attempted and failed.

注意:显示名称、文化和公钥标记是相同的。

那么,有什么不同(除了版本号)?为什么 .NET 找不到策略文件?我们需要做什么黑魔法来克服这个问题(直到我们可以放弃对他们的 9.1 平台的支持)?

【问题讨论】:

    标签: .net .net-2.0


    【解决方案1】:

    啊,在互联网上发布您的问题的魔力:

    看起来策略文件的路径包含“9.2”版本字符串作为文件夹名称的一部分,我只能假设这意味着它将仅针对供应商库的 9.2 版本的请求进行解析。

    所以它看起来没有完全安装(因为策略文件本身会重定向 9.0 版以后)。

    我们可以将自己的重定向包含在应用程序配置文件中,如here 所述;尽管这需要以供应商软件的版本为条件。

    我承认我并不太热衷于将其作为解决方案......

    【讨论】:

      猜你喜欢
      • 2015-11-14
      • 2017-02-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-16
      • 2021-01-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多