This error message shows when I try run my WCF service in VS, and I'm trying to figure out what it's actually referring to by 'client configuration' and 'service contract':
The contract 'IMyService' in client configuration does not match the name in service contract
I assume the service contract part refers to this:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace = "http://xxx/yyy", ConfigurationName = "IMyService")]
public interface IMyService
{
// CODEGEN: Generating message contract since the operation MyService is neither RPC nor document wrapped.
[System.ServiceModel.OperationContractAttribute(Action = "", ReplyAction = "*")]
[System.ServiceModel.XmlSerializerFormatAttribute()]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(Task))]
SendResponse Request(SendRequest request);
}
Any ideas what the client configuration refers to?
Edit: In my web.config I have this section for system.serviceModel:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MyServiceBinding">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="XXX.YYY.MyService">
<endpoint binding="basicHttpBinding" bindingConfiguration="MyServiceBinding" name="MyServiceSendHttps"
contract="IMyService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost" />
</baseAddresses>
</host>
</service>
</services>
Best Answer
I had the same problem and I spent many hours looking for the solution. Then I found this article about generated code by the WCF tool svcutil.exe.
Generated C# code is not guaranteed to be also suitable for a service-side contract. In my case the problem was in ReplyAction = "*" (which I see also in the question). According to MSDN documentation:
After changing
to
was the problem solved.