I have a WCF service let's call it UserService
. The UserService
has a reference to a class library. Let's call it DoWork.dll
. The DoWork.dll
has a WCF service reference to a different service we'll call CompanyService
.
Now, when I first tried calling the UserService
I would get an endpoint not configured error message. After reading around the web I've found that I need to add the CompanyService
bindings and client information into the UserService
's web.config
under the <system.serviceModel>
node.
Here it is:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IComapnyService" />
</basicHttpBinding>
</bindings>
<client>
<endpoint name="BasicHttpBinding_ICompanyService"
address="http://it-dev.company.local:81/Project/Copmpany/CompanyService.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IComapnyService"
contract="CompanyService.ICompanyService" />
</client>
The problem I have is the contract="CompanyService.ICompanyService"
shows me the error:
The 'contract' attribute is invalid - The value 'CompanyService.ICompanyService' is invalid according to its datatype 'clientContractType' - The Enumeration constraint failed.
Now, if I add the CompanyService
reference directly to the UserService
WCF project, the error goes away (obviously). However, I shouldn't have to do this. I have tried fully qualifying the namespace the ICompanyService
contract is in and that doesn't work either. I have deleted the .suo file and rebuild the project and that doesn't work either (suggested elsewhere on the web). Also, if I type contract=
, I get the drop down list but CompanyService.ICompanyService
is nowhere to be found (only when I reference the service directly in the UserService
project).
I have tried configuring it using Tools > WCF Service Configuration Editor
and that does not help.
I should note that everything seems to work fine, but I don't like the fact that intellisense is giving me the blue squiggly underline and that error message. I have a feeling I need something else in the web.config
to get this to work since the UserService
references the DoWork.dll
, which in turn references the CompanyService
whose contract I cannot see properly.
Any suggestions are much appreciated. Thanks in advance.