GoDaddy and many ASP.NET hosting company operate IIS under medium trust. As such, you will need to make a number of modifications to your app.config/web.config to make WCF work. Assuming your WCF service is compiled against the 3.5 framework, the following is a list of errors I encountered along the way and the respective solution.
Error:
There is no build provider registered for the extension ‘.svc’. You can register one in the <compilation><buildProviders> section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value ‘Web’ or ‘All’.
Solution:
<compilation> <buildProviders> <add extension=".svc" type="System.ServiceModel.Activation.ServiceBuildProvider, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> </buildProviders> </compilation>
Error:
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
Solution:
<system.serviceModel>
...
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://services.edoverip.com/" />
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
...
</system.serviceModel>
Error:
The WSHttpBinding with name WSHttpBinding failed validation because it contains a BindingElement with type System.ServiceModel.Channels.SymmetricSecurityBindingElement which is not supported in partial trust. Consider disabling the message security and reliable session options, using BasicHttpBinding, or hosting your application in a full-trust environment.
Solution:
This one is a bit tricky. If you prefer to use wsHttpBinding, you will have to set the Security Mode to either None or Transport. For example, to set it to None, it looks something like this…
<bindings>
<wsHttpBinding>
<binding name="wsHttp">
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="DistanceWS.ServiceBehavior" name="DistanceWS.Service">
<endpoint binding="wsHttpBinding" bindingConfiguration="wsHttp" contract="DistanceWS.IService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/Design_Time_Addresses/DistanceWS/Service/" />
</baseAddresses>
</host>
</service>
</services>
That’s all I can think of for now. I will update this post if I come across anything else. Meanwhile, enjoy and good luck!
