【问题标题】:entirely removed <system.serviceModel> yet still receive multiple http endpoints error完全删除 <system.serviceModel> 但仍然收到多个 http 端点错误
【发布时间】:2013-05-05 03:37:51
【问题描述】:

我收到此错误: 这个集合已经包含一个带有 http 方案的地址。此集合中的每个方案最多可以有一个地址。如果您的服务托管在 IIS 中,您可以通过将“system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled”设置为 true 或指定“system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters”来解决问题。

如果我设置 那么我得到这个错误:

当 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' 在配置中设置为 true 时,端点需要指定相对地址。如果您在端点上指定相对侦听 URI,则地址可以是绝对地址。要解决此问题,请为端点指定一个相对 uri

好的,所以我的问题是,如果我从配置文件中完全删除整个部分,我仍然会收到第一个错误。这意味着当配置文件中没有任何东西时,IIS 认为我有多个端点。 我在 Windows 2012 服务器(iis 8)上安装了新的 IIS,asp.net 页面托管得很好。该应用程序在 windows 7 和 windows 2003 server (iis 6) 上运行良好。

这是我的配置文件的服务模型部分:

<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />    
  <service behaviorConfiguration="metadataSupport_Behaviour" name="myserver.Service.Gateway">
    <host>
      <baseAddresses>
        <add baseAddress="http://www.myserver.com.au/Service/"/>
      </baseAddresses>
    </host>
    <endpoint binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_Configuration_NoSecurity" contract="myserver.Service.IGateway"
      address="Gateway.svc" listenUri="http://www.myserver.com.au/Service/Gateway.svc">
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange">
    </endpoint>
  </service>      
</services>

<bindings>      
  <basicHttpBinding>        
    <binding name="basicHttpBinding_Configuration_NoSecurity" receiveTimeout="23:10:00" sendTimeout="23:10:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="32000" maxStringContentLength="8192000" maxArrayLength="16384000" maxBytesPerRead="1024000" maxNameTableCharCount="16384000" />
      <security mode="None">
        <transport clientCredentialType="Windows" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>
    <behavior name="metadataSupport_Behaviour">
      <serviceMetadata httpGetEnabled="true" httpGetUrl="http://www.myserver.com.au/Service/Gateway.svc" httpsGetEnabled="true"
        httpsGetUrl="https://www.myserver.com.au/Service/Gateway.svc"/>
      <serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="false" httpsHelpPageEnabled="false"/>
    </behavior>

    <behavior name="basicHttp_ServiceBehavior">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>

  </serviceBehaviors>
</behaviors>

请帮忙!

【问题讨论】:

    标签: wcf iis-8 windows-server-2012


    【解决方案1】:

    好的,通过完全剥离所有 servicemodel 部分并将其替换为:

    <system.serviceModel>
            <behaviors>
              <serviceBehaviors>
                <behavior>
                  <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
                  <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
                  <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
                  <serviceDebug includeExceptionDetailInFaults="false"/>
                </behavior>
              </serviceBehaviors>
            </behaviors>
            <protocolMapping>
                <add binding="basicHttpsBinding" scheme="https" />
            </protocolMapping>    
             <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      </system.serviceModel>
    

    以上是新创建的 .net 4.5 WCF IIS 托管服务的默认服务配置。这意味着我必须添加/编辑这些:

    <httpRuntime targetFramework="4.5"/>
        <compilation targetFramework="4.5"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-05-16
      • 2021-03-15
      • 2020-12-25
      • 2013-03-27
      • 2017-06-12
      • 1970-01-01
      • 2016-12-25
      相关资源
      最近更新 更多