I as building a small webservice to publish here on VikingWorks. The purpose was as much getting a feel for the structure as it was solving a problem. I quickly wrote a simple webservice that inserted a row into a database (for logging purpose). Then i thought my problems were over - how wrong I was

To publish a webservice you need to go into the Visual Studio (2008) "Build" menu and choose "publish". This web site is running on a hosted provider, a webhotel. I was gonna choose to FTP my solution up and thus i setup the proper location , username and password - and voila - it was published. Now i thought my problems as over - still I was wrong.

The files had all been copied to the FTP, no problems there but when i tried to access the .svc page through my Internet Explorer i got an error saying:

This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. Parameter name: item

After a lot of googling on the internet i found this solution, which apprears to be working:

  1. modify the App.Config file in the WCF service, and add a new tag below the <system.serviceModel> tag, with the following :

    <serviceHostingEnvironment>
      <baseAddressPrefixFilters>
        <add prefix="http://subdomain.domain:80"/>
      </baseAddressPrefixFilters>
    </serviceHostingEnvironment>


    and modify the endpoint (a bit further down the same file) to the following:

    <endpoint address="http://subdomain.domain.dk:80/VikingLogService.LogService.svc" binding="wsHttpBinding" contract="VikingLogService.ILogService"/>
  2. now publish again and it works

All in all i think i spend a couple of hours looking for a solution to this problem. Finally got it working.