I have a WCF service hosted with WebHttpBinding. The service is very simple, an operation contract that takes several parameters. My WCF client, automatically created after using the "Add Service Reference", cannot directly use the WCF service. The error occurs only for WebHttpBinding, but not for others.
Server side
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "Submit2String", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped)]
string Submit2String(string input1, string input2);
Client side
ExpenseServiceClient proxy = new ExpenseServiceClient();
proxy.Submit2String("test1", "test2");
When I test my code above, I get the following error:
Error: InvalidOperationException was unhandled by user code
Manual addressing is enabled on this factory, so all messages sent must be pre-addressed.
Here's what my automatically created configuration file looks like after using the "Add Service Reference":
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="webHttp">
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</webHttpBinding>
</bindings>
<client>
<endpoint binding="webHttpBinding"
bindingConfiguration="webHttp"
contract="ExpenseService.IExpenseService"
address="http://localhost/myservices/ExpenseService.svc">
</endpoint>
</client>
</system.serviceModel>
source
share