100% Australian Windows Web Hosting
  • Knowledge Base

Hosting a WCF Service 

Was this helpful? (2) (0)

To host a WCF service from within IIS7 or IIS6 the following changes to the web.config may be required:

  • Set the binding to basicHttpBinding
  • Add a prefix to the baseAddressPrefixFilters (as described below)
baseAddressPrefixFilters

When hosting a WCF service from within IIS7 or IIS6, an error may occur due to the way WCF handles multiple host headers:

This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection.

To resolve this issue the following needs to be added within the <system.serviceModel> tags of your web.config
For example, if your service is located at http://your-web-site-address/service.svc a prefix will need to be setup as per below:

 <serviceHostingEnvironment>
  <baseAddressPrefixFilters>
          <add prefix="
http://your-web-site-address"/>
  </baseAddressPrefixFilters>
 </serviceHostingEnvironment>


This will specify that only the address listed above can be used as the service endpoint.

Tags: WCF, SVC, Web Services