Hello Folks,
Today I will talk about an issue that one of my friend was facing.
He created a WCF web service. Web service used to get build successfully but when
try to browse the same was getting the error.
The contract name 'IService' could not be found in the list of contracts implemented
by the service 'Service'.
Where Iservice is Interface name and Service is the name of service.
After little digging I figured that the endpoint entry for the service in
web.config was as
<endpoint
binding="basicHttpBinding"
bindingConfiguration="httpsendpointconfig"
name="httpsendpoint"
contract="IService">
Where as the the Iservice interface was as
namespace
wcfService
{
[ServiceContract]
public interface
IService
{
[OperationContract]
string MethodA(string
input);
}
}
If you watch the class carefully you will figure out that interface IService was
within the NameSpace wcfservice.
Seeing this I changed the contract attribute from IService to wcfService.IService.
After making this change the service started working fine.
So the catch is while provide the value to contract attribute provide the fully
qualified name i.e. <NameSpace>.<Interface name>
Happy Coding J