Nathan J Pledger

Program.X musings from the Isle of Man concerning ASP.NET, in particular accessibility, web standards and neat ideas.

WCF Exception: "There can be at most one address per scheme in this collection"

I'm beginning to see why people dislike WCF. 

I'm working on using WCF to feed an AJAX TreeView, and demos of it are FAST. However, in my debugging on my dev server I bumped into the exception:

"There can be at most one address per scheme in this collection"

The posters at http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/9e248455-1c4d-4c5c-851c-79d9c1631e21/#page:1 seem to be most vocal about the definiciencies of WCF in this respect - and they'd be right. What were Microsoft thinking? Most web applications need to respond to at least two domains to overcome the vagaries of user-inputted URLs, eg:

  • www.myapp.mysite.com
  • mapp.mysite.com
  • myapp

Are all potentially valid patterns for accessing an internal web application. We shouldn't need workarounds to get this to work.

Removing the extra host header record fixes the issue. Surely they weren't expecting people to write their WCF services under a separate, discrete URL, like wcf.myapp.mysite.com?

 

 

Posted: Mon, Mar 16 2009 11:39 AM by Nathan Pledger | with 3 comment(s)
Filed under:

Comments

Grant Samuels said:

There is a simple fix for this in the WCF configuration, just add this before the closing system.servicemodel tag in your config file:

<serviceHostingEnvironment>

     <baseAddressPrefixFilters>

       <add prefix="http://www.thebaseaddresswcfshouldlistento.com"/>

     </baseAddressPrefixFilters>

   </serviceHostingEnvironment>

# March 20, 2009 4:06 AM

Nathan Pledger said:

Ah, excellent, thanks a lot.

Google didn't serve me too well that time, then!

# March 20, 2009 8:26 AM

Lokkers said:

Grant's solution is excellent - that's just fixed an issue I've spent the last four hours trying to fix!

# May 15, 2009 11:04 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Please add 5 and 1 and type the answer here: