Dot Net Solutions
George V Place,
4 Thames Avenue
Windsor
Berkshire
SL4 1QP
Great Britain
0845 402 1752
GEO: -0.606174, 51.4843
 
 
 
 

Hosting WCF service in IIS 

Tags: WCF

If you run WCF service in IIS under a web site with multiple host headers, you will get the following exception:

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

From the documentation, Deploying an IIS-Hosted WCF Service:

Configure the WCF service

IIS-hosted WCF services store their configuration in the applications Web.config file. IIS-hosted services use the same configuration elements and syntax as WCF services hosted outside of IIS. However, the following constraints are unique to the IIS hosting environment:

  • Base addresses for IIS-hosted services.

  • Applications hosting WCF services outside of IIS can control the base address of the services they host by passing a set of base address URIs to the ServiceHost constructor or by providing a <host> element in the service’s configuration. Services hosted in IIS do not have the ability to control their base address; the base address of an IIS-hosted service is the address of its .svc file.

As you can see, the base address is determined automatically by the WCF library when you run your WCF service in IIS, but it fails to determine its base address when the hosting web site configured for multiple host headers:

 

If you remove the additional host headers from the host web site configuration, you won't get such like exception again.

Published: 26 Jan 2007  11:52
0  Comments  |  Trackback Url  | 0  Links to this post | Bookmark this post with:        

Links to this post

No linkbacks added

Comments

No comments added yet

 
 
 
 

Post comment

Name *:
URL:
Email:
Comments:


CAPTCHA Image Validation


 
 
 
 

Related posts