【发布时间】: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。
【问题讨论】: