0

嗨,我需要使用企业库 5 来保持企业环境中的全面一致性。不幸的是,我们的机器上安装了 biz talk。企业库似乎与 ESB Toolkit 发生冲突。ESB Toolkit 在 machine.config 中为 4.1 版的企业库创建一个部分。每次我运行我的应用程序时,它都会从 machine.config 中读取配置,并且应用程序会捕获异常。

为了解决这个问题,我包括

<section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> 

在我的 web.config 文件中但是当我运行它时它说

There is a duplicate 'enterpriseLibrary.ConfigurationSource' section defined 

因为它仍然会去 machine.config 来读取 enterpriseLibrary.ConfigurationSource。我该如何解决这个问题?

4

2 回答 2

0

不要添加重复部分,而是执行绑定重定向

<dependentAssembly>
      <assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Common" publicKeyToken="31BF3856AD364E35"/>      
      <bindingRedirect oldVersion="4.1.0.0" newVersion="5.0.505.0" />
</dependentAssembly>
于 2013-05-07T03:26:03.770 回答
0

我已经解决了这个问题,我的答案在以下链接ESB Toolkit and Enterprise Library collision with IIS Web.Config

我为得到答案而采取的故障排除步骤可在以下 Microsoft 论坛上找到。 ESB 工具包和企业库与 IIS Web.Config 冲突

于 2016-08-23T03:30:25.203 回答