The Problem :I faced this issue when hosting my WCF application on my shared hosting, that’s what I got:
” 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 solution involves two simple steps
1. Creating a Host Factory class in WCF project
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel.Activation;
using System.ServiceModel;
namespace <Your namespace>
{
/// <summary>
/// Summary description for CoreServiceHostFactory
/// </summary>
public class CoreServiceHostFactory : ServiceHostFactory
{
protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
{
// Specify the exact URL of your web service
Uri webServiceAddress = new Uri(“http://yourdomain/yourservice.svc”);
ServiceHost webServiceHost = new ServiceHost(serviceType, webServiceAddress);
return webServiceHost;
}
}
}
2. Adding factory reference in .svc file
<%@ ServiceHost Language=”C#” Debug=”true” Service=”YourNameSpace.YourService”
CodeBehind=”~/App_Code/YourService.cs” Factory=”YourNameSpace.CoreServiceHostFactory” %>
Using the approach above I was able to host my WCF right.
The other easy solution I found:
Add a serviceHostingEnvironment section in <system.serviceModel> somewhat like
<serviceHostingEnvironment aspNetCompatibilityEnabled=”true”>
<baseAddressPrefixFilters>
<add prefix=”http://yourdomain.com/servicename.svc”/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
working 100% now



