【问题标题】:BindingRedirect on Azure Worker Role not being applied未应用 Azure Worker Role 上的 BindingRedirect
【发布时间】:2015-08-27 16:12:37
【问题描述】:

我有一个 Web 项目部署到 Azure Worker 角色。我创建了一个带有绑定重定向的 web.config,以及一个格式为 My.ProjectName.dll.config 的已编译代码的配置文件 - 这是以下建议:Assembly binding redirect not working

我正在使用 Azure SDK 1.7。

问题在于,尽管在两个配置文件中都有正确的绑定重定向(这种方法适用于多个其他工作角色),但我反复看到工作角色在部署时因问题而回收。

检查事件日志显示这是 Castle.Windsor 的绑定重定向问题:

WaIISHost
Role entrypoint could not be created: System.TypeLoadException: Unable to load the role entry point due to the following exceptions:
-- System.IO.FileLoadException: Could not load file or assembly 'Castle.Windsor, Version=3.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Castle.Windsor, Version=3.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'

我已启用融合日志记录以获取更多详细信息,并且我可以看到角色入口点加载:

  • F:\base\x64\WallSHost.exe.config
  • Machine.config

我不想将绑定重定向放在那里,因为在部署过程中我无法控制这些文件。

我确定我在这里遗漏了一些简单的东西 - 关于我可能遗漏的任何建议?

作为参考,我的绑定重定向包含以下内容(在两个配置文件中):

 <dependentAssembly>
        <assemblyIdentity name="Castle.Windsor" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" />
      </dependentAssembly>

实际使用的 Castle.Windsor 版本是 3.3.0.43。

【问题讨论】:

    标签: c# azure


    【解决方案1】:

    经过进一步调查,我们发现我们在解决方案的各个项目中安装了三个版本的 Castle.Windsor:

    • 3.2.0
    • 3.2.1
    • 3.3.0

    我们的一个外部包依赖于特定版本的 Castle。

    一旦版本在解决方案中的所有项目中对齐,这个问题就消失了 - 我仍然需要在 My.ProjectName.dll 中有正确的绑定重定向

    【讨论】:

      猜你喜欢
      • 2017-09-06
      • 2015-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多