developers.de
daenet's .NET Community

How to enable multiple site bindings in WCF 4.0

Damir Dobric Posts

 

Damir@Phone    



My upcoming sessions:

AppFabric Applications at
NRW Conf 2011
09.Sept.2011 Wuppertal

HTML5 widgets in WP7+
Monodroid
Mobility Day
21.Sept.2011 - Zagreb

AppFabric and WCF sessions at
Advanced Developer Conference
26.-27. Oktober 2011 in Frankenthal

AppFabric Applications, queues, topics and more at
Prio Conference
02. - 03. November 2011 in Meistersingerhalle Nürnberg

AppFabric Applications deep dive hosted by
.NET User Group Frankfurt
17.Nov.2011 18.30-22.30 Microsoft - Bad Homburg 

 

 

This post describes shortly how to enable multiple site bindings in WCF 4.0. Open IIS 7 Manager and create new site. Add two bindings to the site like shown in the picture below:

image
After that either configure your DNS or change host file %SYSTEM%\System32\drivers\etc\hosts like:


127.0.0.1    sample1
127.0.0.1    sample2

When you now browse now for the service page by http://sample1/MyService.svc or http://sample2/MyService.svc you should get following error:

This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item

To make this working open the service’s config file and add following in the serviceModel element:

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

That’s all…


Posted Feb 28 2010, 01:00 AM by Damir Dobric
Filed under: ,

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
daenet GmbH