"Already This collection contains an address with scheme http. MOST There Can Be at one address per scheme in this collection. "
Well recently I have come across this error message, has left me at the time of deployment of a WCF service in local mode had no problems, digging a bit I found that it is as IIS hosting services for allowing a single direction scheme (HTTP), for which shared hosting servers gives us this problem, in my case I solved it by creating a class Factory ServiceHostFactory inherits and overwrite the method that returns the ServiceHost with only one direction:
public class CustomHostFactory: ServiceHostFactory
{protected override CreateServiceHost ServiceHost (Type serviceType, Uri [] baseAddresses) {
Uri
webServiceAddress = new Uri ( " http://dominio.com/Service.svc " ) ServiceHost
WebServiceHost = new ServiceHost (serviceType, webServiceAddress)
WebServiceHost return;
}}
Now we only need to tell the service to use this class as
Factory\u0026lt; ;% @ ServiceHost Language = "C # " Debug = "true " Service = " Services.MyService " Factory = " Services.CustomHostFactory " %>
This we will not have this error and our service will work properly.
addition to this are other options for how to solve this problem as in the following links:
WCF: This collection contains Already an address with scheme http
how can WCF support multiple IIS Binding Specified per site?
I hope you can avoid a few headaches.
0 comments:
Post a Comment