When trying to access my WCF hosted in IIS7..I am getting this error.
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
Parameter name: item
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
Parameter name: item
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
Parameter name: item]
System.ServiceModel.UriSchemeKeyedCollection.InsertItem(Int32 index, Uri item) +15583484
System.Collections.Generic.SynchronizedCollection`1.Add(T item) +65
System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri[] addresses) +62
System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +266
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +42
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +427
System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +604
System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +46
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +654
[ServiceActivationException: The service '/MBPublicScheme/Default.svc' cannot be activated due to an exception during compilation. The exception message is: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
Parameter name: item.]
System.ServiceModel.AsyncResult.End(IAsyncResult result) +15700960
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +15623609
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +265
System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +227
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171
I have gone through so many sites and did tried all the possible solutions like :
With ASP.NET 4.0, add the following lines to your web.config:
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
With ASP.NET 2.0/3.0/3.5, add the following lines to your web.config:
<system.serviceModel>
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="httplinktoyoursite"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
</system.serviceModel>
They may working in different scenarios but in my case i have to remove the one of the bindings in IIS.
Remove the binding with IPAddress.