Search code examples
wcfiishttpswcf-binding

WCF HTTPS and multiple sites in IIS


I am trying to configure IIS to host one set of binaries in two IIS websites. So we want to be able to access the urls:

internal.example.com and external.example.com are set up as different IIS sites to allow us to assign them different application pools. However when I added HTTPS support to our web.config, the internal HTTP support stopped working; http://internal.example.com/ADataService now returns the error:

Could not find a base address that matches scheme https for the endpoint with binding CustomBinding. Registered base address schemes are [http].

Here are the details of our web.config

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <bindings>
      <customBinding>
        <binding name="jsonCustomMapper">
            <webMessageEncoding webContentTypeMapperType="Service.JSONCustomMapper, Service" />
            <httpTransport manualAddressing="true" />
        </binding>
        <binding name="httpsjsonCustomMapper">
            <webMessageEncoding webContentTypeMapperType="Service.JSONCustomMapper, Service" />
            <httpsTransport manualAddressing="true" />
        </binding>
      </customBinding>
    </bindings>
    <behaviors>
      <endpointBehaviors>
        <behavior name="jsonBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="defaultBehavior">
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="Service.Service" behaviorConfiguration="defaultBehavior">
        <endpoint address="json" binding="customBinding" bindingConfiguration="jsonCustomMapper" behaviorConfiguration="jsonBehavior" contract="Service.IJSONService" />
    <endpoint address="json" binding="customBinding" bindingConfiguration="httpsjsonCustomMapper" behaviorConfiguration="jsonBehavior" contract="Service.IJSONService" />
      </service>
    </services>
  </system.serviceModel>

From what I understand multipleSiteBindingsEnabled="true" and HTTPS do not mix, but I don't understand what resources they would be sharing? If we have internal.example.com and external.example.com hosted in different app pools, I thought they would have process isolation?


Solution

  • seems that adding an HTTPS certificate to the site for "internal.example.com" fixed the issue. Note: without this certificate we were not able to access internal.example.com over either HTTP or HTTPS, with certificate both mechanisms work correctly.