1

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

如果我设置 <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 那么我得到这个错误:

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

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

请帮忙!

4

1 回答 1

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"/>
于 2013-05-11T00:55:09.560 回答