1
votes

I am getting this error: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.

If I set <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> then I get this this error:

When 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' is set to true in configuration, the endpoints are required to specify a relative address. If you are specifying a relative listen URI on the endpoint, then the address can be absolute. To fix this problem, specify a relative uri for endpoint

Ok so my question is this, If I entirely remove the whole section from the config file, I still receive the first error. Meaning IIS thinks that I have multiple endpoints when there are none what-so-ever in the config file. I have a new install of IIS on a windows 2012 server (iis 8), asp.net pages are hosted fine. The app runs fine on both windows 7 and windows 2003 server (iis 6).

This is my service model section of the config file:

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

Please please help!

1

1 Answers

1
votes

ok managed to get it to work by complete stripping out all of the servicemodel section and replacing it with this:

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

Above is the default service config from a newly created .net 4.5 WCF IIS hosted service. Which means I had to add/edit these:

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