【问题标题】:ESB Toolkit and Enterprise Library collision with IIS Web.ConfigESB 工具包和企业库与 IIS Web.Config 冲突
【发布时间】:2016-08-22 23:26:47
【问题描述】:

此问题与此处在堆栈溢出中提出的问题类似 ESB Toolkit and Enterprise Library collision

我已经尝试了建议的解决方案,但仍然无法让我的网络服务正常工作。

有人有答案吗,我也有类似的问题。 Biztalk ESB 已安装,它破坏了我的 web.config。

这就是我的 web.config 的样子

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

  <enterpriseLibrary.ConfigurationSource selectedSource="EntLib File-based Configuration Source SomeThingElse">
    <sources>
      <add name="EntLib File-based Configuration Source SomeThingElse" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" filePath="WebEntLib.config" />
    </sources>
    <redirectSections>
      <add sourceName="EntLib File-based Configuration Source SomeThingElse" name="loggingConfiguration" />
    </redirectSections>
  </enterpriseLibrary.ConfigurationSource>

这就是我的 webEntLib.config 的样子。

    <configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
  </configSections>
  <loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
    <listeners>
      <add name="Rolling Flat File Trace Listener"
          type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          footer="" formatter="Text Formatter" header="" rollInterval="Day"
          rollSizeKB="1024" maxArchivedFiles="5" fileName="D:\Temp\logs\SomeThingElse\SomeThingElseTrace.log"/>
    </listeners>
    <formatters>
      <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
           template="{timestamp} - [{severity}] : {category} {eventid} - {message}"
           name="Text Formatter" />
    </formatters>
    <categorySources>
      <add switchValue="All" name="General">
        <listeners>
          <add name="Rolling Flat File Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="Debug">
        <listeners>
          <add name="Rolling Flat File Trace Listener" />
        </listeners>
      </add>
    </categorySources>
    <specialSources>
      <allEvents switchValue="Off" name="All Events" />
      <notProcessed switchValue="Off" name="Unprocessed Category" />
      <errors switchValue="All" name="Logging Errors &amp; Warnings">
        <listeners>
          <add name="Rolling Flat File Trace Listener" />
        </listeners>
      </errors>
    </specialSources>
  </loggingConfiguration>

我什至尝试了您在 web.config 和 webEntLib.config 中都进行重定向的建议。

      <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Common" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="4.1.0.0" newVersion="5.0.505.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Logging" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="4.1.0.0" newVersion="5.0.505.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

有关 dll 重定向的 Microsoft 文章位于以下链接 Redirecting Assembly Versions

但它似乎不起作用。我做错了什么或者我还能做什么?

我什至在网站的 bin 文件夹中添加了专用的 Microsoft.Practices.EnterpriseLibrary.Common.dll 和 Microsoft.Practices.EnterpriseLibrary.Logging.dll 并使用 GACUTIL 注册它们,因此现在服务器包含在它的 GAC 中跟踪二进制文件。

    PS > .\gacutil -l Microsoft.Practices.E
nterpriseLibrary.Common
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

The Global Assembly Cache contains the following assemblies:
  Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, proce
ssorArchitecture=MSIL
  Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, pro
cessorArchitecture=MSIL

Number of items = 2

PS > .\gacutil -l  Microsoft.Practices.
EnterpriseLibrary.Logging
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

The Global Assembly Cache contains the following assemblies:
  Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, proc
essorArchitecture=MSIL
  Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, pr
ocessorArchitecture=MSIL

Number of items = 2

我在网上找到的另一个参考如下所列,但它并没有教我如何解决这个问题。 ESB Toolkit 2.1 mess up Enterprise Library 5.0 big time

我什至向 Microsoft 发布了一个后续问题。 ESB Toolkit 2.1 and Stand Alone Enterprise Library 5.0 Application Configuration Issue

【问题讨论】:

标签: iis web-config esb-toolkit-2.0


【解决方案1】:

我解决了。我对我的配置进行了以下更改,现在 Web 服务正在运行。

      <configSections>
     <section name="enterpriseLibrary.ConfigurationSource.SomeThingElse" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
  </configSections>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Common" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="4.1.0.0" newVersion="5.0.505.0" />
        <publisherPolicy apply="no" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Logging" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="4.1.0.0" newVersion="5.0.505.0" />
        <publisherPolicy apply="no" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

  <enterpriseLibrary.ConfigurationSource selectedSource="Local Application Configuration Source">
    <sources>
      <add name="Local Application Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" filePath="C:\inetpub\SomeThingElse\WebEntLib.config" />
    </sources>
    <redirectSections>
      <add sourceName="Local Application Configuration Source" name="loggingConfiguration" />
    </redirectSections>
  </enterpriseLibrary.ConfigurationSource>

我错的地方重定向工作是将“enterpriseLibrary.ConfigurationSource”XML标签重命名为“enterpriseLibrary.ConfigurationSource.SomeThingElse”

一旦我删除了 SomeThingElse,它现在就可以正常工作了。

在我采用这个解决方案之前,我还阅读了

Sharing Configuration Sections across Multiple Applications

【讨论】:

    猜你喜欢
    • 2013-04-26
    • 1970-01-01
    • 2011-08-23
    • 1970-01-01
    • 2012-04-26
    • 1970-01-01
    • 2011-07-06
    • 2012-11-22
    • 1970-01-01
    相关资源
    最近更新 更多