The contract name could not be found in the list of contracts implemented by the service

When trying to add a service reference to my SilverLight project I kept getting this error message

The contract name xxxxxxx could not be found in the list of contracts implemented by the service

I looked around the web and couldn't find anything of any use (yes, I had added ServiceContract to my interface). The solution was really simple! In my Web.Config I had the wrong interface defined. IApplicationService was defined in another assembly, one I had added a namespace to, so I additionally needed to add the namespace before the interface name.

All I then had to do was to add the following attribute to the service implementing the interface and it seemed to import fine.

[AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]

Comments

Nick Crisp said…
Hi Pete

Your code from the web.config isn't showing...

Nick
Sandeep said…
This comment has been removed by the author.
Sandeep said…
Hello All,

Below link provide a good explanation of one of the scenario for this error and solution for the same

http://www.a2zmenu.com/WCF/Contract%20name%20could%20not%20be%20found.aspx

Popular posts from this blog

Connascence

Convert absolute path to relative path

Printing bitmaps using CPCL