创建配置部分时发生错误-找到重复的'<identityconfiguation>'配置元素

时间:2018-06-26 07:24:18

标签: c# web-services wcf iis web-config

尝试导航到我们已创建并安装的服务时出现以下错误:

为system.identityModel创建配置节处理程序时发生错误:ID7029:在“ system.identityModel”配置节中找到了重复的名为“''的'identityConfiguation'配置元素。

Line 74:     <validation validateIntegratedModeConfiguration="false" />
Line 75:   </system.webServer>
**Line 76:   <system.identityModel>**
Line 77:     <identityConfiguration name="">
Line 78:       <claimsAuthenticationManager type="Sage.IdentityModel.Claims.Sage200.WCFServiceClaimsAuthenticationManager, Sage.IdentityModel.Claims.Sage200" />

这是正在使用的web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=***"/>
    <section name="system.identityModel.services" type="System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=***"/>
    <section name="sage.identityModel.tokens.sageID" type="Sage.IdentityModel.Tokens.SageID.Configuration.ModuleConfigurationSection, Sage.IdentityModel.Tokens.SageID"/>
  </configSections>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />

    <add key="credentialsFile" value="c:\sage\logon\credentials.xml" />
    <add key="Sage200SiteLogonPath" value="c:\Sage\Logon" />
    <add key="ServerRootPath" value="C:\Sage" />
    <add key="SystemAdministration" value="Local" />
    <add key="Sage200Path" value="C:\inetpub\Sage 200 App Services\Sage200Services\Bin\" />
  </appSettings>

  <system.web>
    <compilation targetFramework="4.0" />
    <trust level="Full" />
  </system.web>

  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DefaultAuthorizationBehavior">
          <serviceThrottling
                        maxConcurrentCalls="16"
                        maxConcurrentSessions="20"
                        maxConcurrentInstances="16" />
          <serviceMetadata httpGetEnabled="false" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceAuthorization principalPermissionMode ="Always" />
          <serviceCredentials useIdentityConfiguration="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https"/>
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>

    <bindings>
      <basicHttpBinding>
        <binding name="SecureHttpBinding"
                 maxBufferPoolSize="104857600"
                 maxReceivedMessageSize="104857600"
                 maxBufferSize="104857600"
                 transferMode="Buffered">
          <security mode="Transport">
            <transport clientCredentialType ="Windows" />
          </security>
          <readerQuotas maxDepth="32"
                        maxStringContentLength="104857600"
                        maxArrayLength="104857600"
                        maxBytesPerRead="4096"
                        maxNameTableCharCount="16384"/>
        </binding>
      </basicHttpBinding>
    </bindings>

    <services>
      <service name="SageWebService.Service1"
               behaviorConfiguration="DefaultAuthorizationBehavior">
        <endpoint address="https://SERVERNAME:PORT/SageWebService/Service1.svc"
                  binding="basicHttpBinding"
                  bindingConfiguration="SecureHttpBinding"
                  contract="SageWebService.IService1"
                  listenUri="/" />
      </service>
    </services>
  </system.serviceModel>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="ApplicationInsightsWebTracking"/>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
           preCondition="managedHandler"/>
    </modules>
    <directoryBrowse enabled="true"/>
    <validation validateIntegratedModeConfiguration="false"/>
  </system.webServer>

  <system.identityModel>
    <identityConfiguration>
      <claimsAuthenticationManager type="Sage.IdentityModel.Claims.Sage200.WCFServiceClaimsAuthenticationManager, Sage.IdentityModel.Claims.Sage200"/>
      <claimsAuthorizationManager type="Sage.IdentityModel.Claims.Sage200.WCFServiceThirdPartyClaimsAuthorizationManager, Sage.IdentityModel.Claims.Sage200"/>
    </identityConfiguration>
  </system.identityModel>

  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
        <listeners>
          <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\log\Traces.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
</configuration>

在此配置或服务器上的machine.config中,我看不到其他定义身份配置部分的地方。我尝试为身份配置部分指定一个唯一的名称,但问题仍然存在。

该应用程序池使用.net v4.0,该服务的目标是v4.5.2

我应该在任何地方找这个吗,还是该错误表示其他地方有问题?

谢谢

1 个答案:

答案 0 :(得分:0)

对于以后可能会看到此问题的任何人,我通过将“身份模型”部分更新为以下内容来解决此问题:

<system.identityModel>
    <remove name="SageIdentity"/>
    <identityConfiguration name="SageIdentity">
      <claimsAuthenticationManager type="Sage.IdentityModel.Claims.Sage200.WCFServiceClaimsAuthenticationManager, Sage.IdentityModel.Claims.Sage200" />
      <claimsAuthorizationManager type="Sage.IdentityModel.Claims.Sage200.WCFServiceThirdPartyClaimsAuthorizationManager, Sage.IdentityModel.Claims.Sage200" />
    </identityConfiguration>
  </system.identityModel>