I experienced the same exception as when trying to combine the two services; which used the SOAP endpoint and the other the REST endpoint.
I think the problem is that WCF does not seem to see operations that use MessageContract in the same ServiceContract as a REST operation. So the way I got around was to split the contracts into two parts, and then the REST endpoint only performed the WebGet operation as follows:
[ServiceContract] public interface IExampleSoapService : IExampleRestService { [OperationContract] void SomeSoapOperation(ExampleMessageContract message); } [ServiceContract] public interface IExampleRestService { [OperationContract] [WebGet(UriTemplate = "/{id}", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)] void SomeRestOperation(int id); }
And then in the configuration:
<services> <service name="ExampleService"> <endpoint name="ExampleService.BasicHttpBinding" binding="basicHttpBinding" contract="IExampleSoapService" address="soap" /> <endpoint name="ExampleService.WebHttpBinding" binding="webHttpBinding" contract="IExampleRestService" /> </service> </services>
One I divided the contracts as follows, the problem seems to go away.
source share