ESB工具包和企业库与IIS Web.Config发生冲突 [英] ESB Toolkit and Enterprise Library collision with IIS Web.Config

查看:101
本文介绍了ESB工具包和企业库与IIS Web.Config发生冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题与堆栈溢出中提出的问题类似 ESB工具包和企业库冲突

This issue is similar with the one raised here in stack overflow ESB Toolkit and Enterprise Library collision

我尝试了建议的解决方案,但仍然无法使我的Web服务正常工作.

I have tried the suggested resolution but still couldn't get my web service to work.

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

Does anyone have answers for this, I have a similar problem. The Biztalk ESB has been installed and it breaks my web.config.

这是我的web.config的样子

This is what my web.config looks like

    <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的样子.

And this is what my webEntLib.config looks like.

    <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处都添加重定向.

I even tried your suggestion of putting in a redirect at both the web.config and the 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文章位于以下链接 重定向程序集版本

The Microsoft article about dll redirect is at the following link Redirecting Assembly Versions

但是它似乎起作用了.我在做错什么还是我还能做些什么?

But it dosent seem to work. What am I doing wrong or what else can I do?

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

I have even added a dedicated Microsoft.Practices.EnterpriseLibrary.Common.dll and the Microsoft.Practices.EnterpriseLibrary.Logging.dll into the bin folder of the web site and have used GACUTIL to register them so now the server contains the following binaries in it's 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搞砸了企业库5.0大时间

One other reference I found on the net is as listed below, but it dosent teach me how to resolve the issue. ESB Toolkit 2.1 mess up Enterprise Library 5.0 big time

我什至向Microsoft发布了后续问题.

I have even posted a followup question to Microsoft. ESB Toolkit 2.1 and Stand Alone Enterprise Library 5.0 Application Configuration Issue

推荐答案

我解决了.我对配置进行了以下更改,并且Web服务现在可以正常工作.

I solved it. I made the following changes to my configuration and the web service is now working.

      <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>

我错误的重定向工作是将XML标记"enterpriseLibrary.ConfigurationSource"重命名为"enterpriseLibrary.ConfigurationSource.SomeThingElse"

The redirection worked where I was wrong is to rename the "enterpriseLibrary.ConfigurationSource" XML tag to "enterpriseLibrary.ConfigurationSource.SomeThingElse"

一旦我删除了SomeThingElse,它现在就可以正常使用了.

once I have removed the SomeThingElse, it is fully working now.

在采用这种解决方案之前,我还曾在

Before I resort to this solution I also had a read up at

在多个应用程序之间共享配置节

这篇关于ESB工具包和企业库与IIS Web.Config发生冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆