IIS hosting on XP: "Collection already contains an address with scheme http"
- Hi, I'm trying to run some of the samples from the 15th April documentation CTP, but they keep failing in IIS with the error "Collection already contains an address with scheme http". I saw another post on the forum but it seems to describe an issue with host headers, which I think doesn't apply to my problem since I'm running XP.
The exact same code hosts OK with the development server (c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.EXE), so this has to be an IIS problem, right? Any ideas about how I could troubleshoot this?
Oh, I was going to try to run servicemodelreg.exe as described in the help to try to fix this, but I can't find it in my fx directory... Is it actually located somewhere else or has its name changed?
thanks!
Answers
- One thing to check --
Open up the IIS Manager snap-in and right-click on the "Default Web Site" and select Properties. On the "Web Site" tab in the "Web Site Identification", click the "Advanced" button.
That should bring up the "Advanced Multiple Web Site Configuration" dialog box. Take a look at the top list box -- if there's more than one entry in there, that's likely the source of this problem.
Technically speaking, when you host services in IIS, the web server provides the base address for your service. These addresses are derived from the Site bindings, which are controlled via this dialog. We support exactly one base address per protocol.
All Replies
I'm not sure which samples you're trying to run. Can you give me a specific sample you're having problems with?
The error is thrown because it's trying to add more than one baseaddress with the same scheme. So in other words, since you're hosting in IIS it's going to have a baseaddress with an http (or https) scheme. If you try to add another baseaddress with http (or https) to the ServiceHost baseaddress collection it will blow up with that error message.
Thanks!
Scott
- One thing to check --
Open up the IIS Manager snap-in and right-click on the "Default Web Site" and select Properties. On the "Web Site" tab in the "Web Site Identification", click the "Advanced" button.
That should bring up the "Advanced Multiple Web Site Configuration" dialog box. Take a look at the top list box -- if there's more than one entry in there, that's likely the source of this problem.
Technically speaking, when you host services in IIS, the web server provides the base address for your service. These addresses are derived from the Site bindings, which are controlled via this dialog. We support exactly one base address per protocol. - Hi Steve, that solved it, thanks!
- Is there any way to specify the correct host address, where there are multiples?
Is there a work around?
Our test and production servers both use multpile addresses, is this going to be addressed in a future release? - I get this error on Windows Server 2003 as well. My sites are all provisioned with multiple host header site bindings. Any workaround at all?
- Is there a workaround for this. In our hosting envirement all servers always have multiple host header values. This means we can't host any wcf service in IIS?
- This is quite important, since I'm a web hoster. Each of my customers' sites are provisioned with serveral ServerBindings in the metabase, not just www.domain.com. This is causing the problem, espcially for shared hosting.
I'd like to offer my customers a simple workaround via web.config if possible. Not everyone has the skills or desire to modify their WCF service just to work around this "feature". They'll just go to another web host that doesn't allow multiple host headers. Not good for business.
Can you offer a workaround, or point me to a KB article that I can give my customers who want to use WCF?
Thanks,
Mark - http://www.robzelt.com/blog/2007/01/24/WCF+This+Collection+Already+Contains+An+Address+With+Scheme+Http.aspx
Make sure you take a look at his comments. - http://geekswithblogs.net/robz/archive/2007/10/02/WCF-in-IIS-with-Websites-that-have-Multiple-Identities.aspx
I added a more complete answer here...
- An issue report has been created on Microsoft Connect, you might consider voting for it: https://connect.microsoft.com/wcf/feedback/ViewFeedback.aspx?FeedbackID=322896
This solved our problem as well. Thanks for taking the time to post a solution. I love the web
. This problem would have taken eons to solve "back in the day".Just for further clarification, is the error simply due to multiple Host Headers being configured or is it because the 2 Host Headers are "pointed at" different IPs?
Many Thanks,
Zack
- Solution in .Net Fx3.5: BaseAddressPrefixFilters
http://blogs.msdn.com/rampo/archive/2008/02/11/how-can-wcf-support-multiple-iis-binding-specified-per-site.aspx


