我有一个部署到Azure Worker角色的Web项目。我创建了一个带绑定重定向的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'
我已启用融合日志记录以获取更多详细信息,我可以看到角色入口点加载:
我不想将绑定重定向放在那里,因为作为部署过程的一部分,我无法控制这些文件。
我确信我在这里遗漏了一些简单的东西 - 关于我可能遗失的任何建议?
作为参考,我的绑定重定向包含以下内容(在两个配置文件中):
<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。
答案 0 :(得分:-2)
因此,经过进一步调查后发现,我们在解决方案中的各种项目中安装了三个版本的Castle.Windsor:
我们的一个外部软件包依赖于特定版本的Castle。
一旦版本在解决方案中的所有项目中对齐,这个问题就消失了 - 我仍然需要在My.ProjectName.dll中有正确的绑定重定向