The contract name \'IMyService\' could not be found in the list of contracts implemented by the service \'MyService\'.. ---> System.InvalidOperationException: The
This is a slightly more uncommon solution, that applied to my situation with the same error:
It's possible that the contract namespace can be overridden, with the following attribute:
[System.ServiceModel.ServiceContractAttribute([...], ConfigurationName = "IServiceSoap")]
public interface ISomeOtherServiceName
Which would require:
<endpoint address="" binding="basicHttpBinding" contract="IServiceSoap" />
Rather than the usual (namespace).ISomeOtherServiceName.
This can be a result of code generation, in my case WSCFBlue
I have a habit of doing this ...
<system.serviceModel>
<services>
<service name="Service" behaviorConfiguration="wsHttpBehaviour">
<endpoint
binding="wsHttpBinding"
contract="IService"
bindingConfiguration="wsHttpBinding"
/>
<endpoint contract="IService" binding="mexHttpBinding" address="mex" />
</service>
when i should do this ...
<system.serviceModel>
<services>
<service name="namespace.Service" behaviorConfiguration="wsHttpBehaviour">
<endpoint
binding="wsHttpBinding"
contract="namespace.IService"
bindingConfiguration="wsHttpBinding"
/>
<endpoint contract="namespace.IService" binding="mexHttpBinding" address="mex" />
</service>
See what i mean ... It's the dumbest thing ever (especially when the app only has 1 or 2 items in it) but a "fully qualified" classname seems to make all the difference.
can you post code of your interface...? as normally this occurs if you haven't specified ServiceContract attribute in your Interface...
Doesn't the contract attribute on the endpoint need to be the fully qualified namespace?
[ServiceContract]
was missing in my case.
@Garry (a bit late, I know)
If your ServiceContract attribute defines a ConfigurationName, this should be the value in the endpoint, not the fully qualified name. I just had this problem now as described by the OP, and this was the solution for me. Hope this helps someone else who stumbles across this.