WCF 3.5 service and multiple http bindings

I am unable to get my WCF service to work with more than one http binding.

In IIS 7, I need to bind http: / service and http: /service.test as port 80.

In mine web.config

I have added baseAddressPrefixFilters but I cannot add more than one

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

      

This gives almost the same error

This collection already contains an address with an http schema. There can be at most one address for each schema in this collection.

as if no files were specified at all (this collection already contains an address with the http scheme. Each scheme can have no more than one address for this collection. Parameter name: element)

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

I also tried to specify multiple endpoints, for example (and only one filter):

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

      

Then only the address given in the filter is saved and the other returns this error:

Server error in application "ISPSERVICE" HTTP Error 400.0 - Bad request

Morten relationship

+2


a source to share


1 answer


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

This collection already contains an address with an http schema. There can be no more than one address according to the scheme in this collection. Name: item parameter



The problem did not happen on my local machine, but on the web server it made it difficult to figure out what was causing it. This happened on the server because my web server is in a co-hosted environment, in which case the WCF service needs to know the host header as well. To do this, I went to <system.serviceModel>

in web.config and added the following:

<serviceHostingEnvironment>
<baseAddressPrefixFilters>    
    <add prefix=http://MyHostHeader />
</baseAddressPrefixFilters>
</serviceHostingEnvironment>

      

0


a source







All Articles