views:

426

answers:

1

I have a WCF service hosted in IIS (7.0) which implements multiple service contracts and therefore defines multiple endpoints (one for each contract). It has been working fine but I have just added an https binding to the IIS web application and I am now getting an activation exception specifying that the service implements multiple contracts but no endpoints are defined in configuration when they actually are. I found this article which solves a similar problem caused by adding host names to IIS, but it doesn't seem to help my situation.

Here is a snippet of my configuration which is relevant:

<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
  <baseAddressPrefixFilters>
    <add prefix="http://localhost/CDC.WebPortal.MidTierAccessService/"/&gt;
  </baseAddressPrefixFilters>
</serviceHostingEnvironment>


<services>
  <service name="CDC.WebPortal.MidTier.MidTierAccessService"
           behaviorConfiguration="MidTierServiceBehaviour" >

    <endpoint address="http://localhost/CDC.WebPortal.MidTierAccessService/MidTierAccessService.svc"
              binding="webHttpBinding" bindingName="RestBindingConfiguration"
              contract="CDC.WebPortal.ServiceContract.IProductService"/>

    <endpoint address="http://localhost/CDC.WebPortal.MidTierAccessService/MidTierAccessService.svc/Category" binding="webHttpBinding" 
              bindingName="RestBindingConfiguration"
              contract="CDC.WebPortal.ServiceContract.ICategoryService"/>

    <endpoint address="http://localhost/CDC.WebPortal.MidTierAccessService/MidTierAccessService.svc/Account" binding="webHttpBinding" 
              bindingName="RestBindingConfiguration"
              contract="CDC.WebPortal.ServiceContract.IAccountService"/>

    <endpoint address="http://localhost/CDC.WebPortal.MidTierAccessService/MidTierAccessService.svc/Order"
              binding="webHttpBinding" bindingName="RestBindingConfiguration"
              contract="CDC.WebPortal.ServiceContract.IOrderService"/>

    <endpoint address="http://localhost/CDC.WebPortal.MidTierAccessService/MidTierAccessService.svc/mex"
              binding="mexHttpBinding" contract="IMetadataExchange" />

  </service>
</services>

Any suggestions are appreciated.

+1  A: 

If you are configuring HTTPS for the binding (say SecureRestBindingConfiguration), you also need to set "https" in the address of the the endpoints that you want to expose as https. e.g.

<endpoint address="https://localhost/CDC.WebPortal.MidTierAccessService/MidTierAccessService.svc"
                  binding="webHttpBinding" bindingName="SecureRestBindingConfiguration"
                  contract="CDC.WebPortal.ServiceContract.IProductService"/>

Keyword: https, SecureRestBindingConfiguration

UPDATE: Assumed you configured https transport within SecureRestBindingConfiguration.

codemeit
I'm not actually using https for the service, I added the https binding to the iis web application for another site that it runs. I realise I can just create another web application without the https binding to use for the service, however I'm wanting to know why this issue has arisen anyway and if it can be fixed.
Simon Fox