Apr 8, 2010

sharepoint 2010 WCF service error

if your sharepoint 2010 have multiple IIS headers, you will get the following error when programming client OM (client.svc) or invoking any other WCF service such as listdata.svc:
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.

By design, WCF can't have multiple bindings for the same schema (HTTP).

Extending web application certainly is a workaround, but modifying web.config should be considered a better solution:

< system.servicemodel >
<servicehostingenvironment aspnetcompatibilityenabled="true">
<baseaddressprefixfilters>
<add prefix="http://sharepoint2010.yourDomain.com/_vti_bin">
</baseaddressprefixfilters>
</servicehostingenvironment>
</system.servicemodel>