Friday, July 16, 2010

WCF Error - This collection already contains an address with scheme http.

If you get the following error with WCF:

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

The most probable reason for this is that you have multiple identities setup in IIS.

image

The easy solution is to remove one of the entries.

But in case you cant remove the other identities for the web-site, then you could look at creating a CustomServiceFactory, that filters out the entries that are not to be mapped to the WCF service endpoint.

Still looking for a better config based solution.

Update: If you are using .Net 3.5 or above, you can use the “BaseAddressPrefixFilters” attribute in the config file. More info: http://blogs.msdn.com/b/rampo/archive/2008/02/11/how-can-wcf-support-multiple-iis-binding-specified-per-site.aspx

No comments: