I have a WCF service with the following configuration:
I think I found out what the problem is.
If I browse to the URL:
http://localhost/myservice/contract
with the WcfTestClient application I can successfully retrieve the service metadata.
So the error really only occurs when I request the URL through a web browser.
The HTTP Bad Request error comes from the fact that the browser issues an HTTP GET request where the contents of the message are in the HTTP headers, and the body is empty.
This is exactly what the WCF mexHttpBinding is complaining about!
In order to get to the service contract via a web browser you will have to explicitly enable it in the service behavior:
The URL to request becomes then:
http://localhost/myservice?wsdl
So, it turns out I was a little too quick in posting this question. However, I'll keep it anyway just for the record.