views:

158

answers:

1

Hi

I can't get my WCF service to work with more than one http binding.

In IIS 7 I have to bindings http:/service and http:/service.test both at port 80

In my web.config I have added the baseAddressPrefixFilters but I can't add more than one

<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://service"/&gt;
<add prefix="http://service.test"/&gt;
</baseAddressPrefixFilters>
</serviceHostingEnvironment>

This gives almost the same error "This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. " as if no filers were specified at all (This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. Parameter name: item)

If I add only one filter then the service works but only responds on the added filter address.

I've also tried with specifing multiple endpoints like (and only one filter):

<endpoint address="http://service.test" binding="basicHttpBinding" bindingConfiguration="" contract="IService" />
<endpoint address="http://service" binding="basicHttpBinding" bindingConfiguration="" contract="IService" />

Then still only the address also specified in the filter works and the other returns this error: Server Error in Application "ISPSERVICE" HTTP Error 400.0 - Bad Request

Regards Morten

A: 

I was trying to deply a WCF service to one of my web servers the other day and ran into a problem. I kept getting the following error message:p>

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 problem didn't happen on my local machine but did on the web server making it a little difficult to figure out what was causing it. It happened on the server because my web server is in a shared hosting environment in which case the WCF service also needs to know the host header. To do this I navigated to in the web.config and added the following:

<serviceHostingEnvironment>
<baseAddressPrefixFilters>    
    <add prefix=http://MyHostHeader />
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
sAeid mOhammad hAshem