This is a mirror of official site: http://jasper-net.blogspot.com/

WCF service hosted in IIS - "This collection already contains an address with scheme http" - Why does this happen?

| Monday, November 15, 2010
I came across this error when I tried hosting a WCF endpoint from a website in IIS. This can be resolved by adding the following section in the web.config file

   <serviceHostingEnvironment aspNetCompatibilityEnabled="true">
     <baseAddressPrefixFilters>
       <add prefix=http://www.myhost.com/ />
     </baseAddressPrefixFilters>
   </serviceHostingEnvironment>


Why does this happen?

When you host a website using a shared hosting provider, it is possible that there are multiple IIS bindings for the site. This results in multiple base addresses for each scheme which WCF doesn't support. Hence, we use the baseAddressPrefixFilters to filter out the IIS bindings and only use the relevant one for the WCF endpoint.

Read more: My Tryst with Code

Posted via email from .NET Info

0 comments: