Today I was playing with WCF and for a change I created a "WCF Service Application" project to act as a WCF service. I removed the default created stuff and added my own service class. I quickly whipped up a client project, and fired up the debugger:
+ [System.ServiceModel.CommunicationException] {"An error occurred while receiving the HTTP response to http://localhost:8083/Service. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details."} System.ServiceModel.CommunicationException
Argh! Why me? A couple of hours, a lot of cursing and trial and erroring later I figured out that the ASP.NET development server must be able to recognize the .svc extension. So the client configuration must refer to the actual .svc file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<client>
<endpoint address="http://localhost:8083/Service.svc" binding="wsHttpBinding" bindingConfiguration="" contract="WcfData.IService"
name="MyService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
The service's config may have the address attribute empty or the explicit reference to the .svc file, but I had the string "http://localhost:8083/Service" initially, which works ok with anything else but ASP.NET hosts. Hosting in a Console app, or windows service using ServiceHost works just fine without .svc extension.
cf7866cf-9816-4ce3-b74a-218728f3137f|0|.0