prkz.de - Blog


Keep it simple

Empty WSDL output of a WCF Service and response 400 Bad Request

written on 18 January 2017
I was running into this problem with a .NET WCF service (hosted with Windows Service Host) that had a custom binding endpoint and a host baseAddress configured in the app.config. The response to a GET request on `http://localhost:9001/myService/?wsdl` was a `400 - Bad Request`. In the Service Trace it said: > *"There is a problem with the XML that was received from the network."* and > *"The body of the message cannot be read because it is empty"* The reason was that I forgot a trailing slash at the end of the base address: ```xml <endpoint contract="..." binding="..." bindingConfiguration="..." /> <host> <baseAddresses> <add baseAddress="http://localhost:9001/myService" /> <!-- Wrong --> <add baseAddress="http://localhost:9001/myService/" /> <!-- Correct --> </baseAddresses> </host> ```