Could not find default endpoint element that references contract ‘Your Service’ in the ServiceModel client configuration section.
When I consume the WCF in a class library project by adding the service reference , I got the following exception message :
Your search - Could not find default endpoint element that references contract 'yourService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element. - did not match any documents.
In order to solve this , you will need copy the System.ServiceModel section of the generated app.config file to the executing assembly project’s .config file (web.config for web application project, app.config for windows or console project) . Then it run like a charm. This is because the app.config file in the class library project is not used by the WCF ,instead the executing assembly project’s .config file will be used.




Thanks much for this… I was going down a much more complex path based on some of the other posts, but when I copied the System.ServiceModel section to the calling WorkerRole, it was all magic. Great stuff.
gr8……………
Thanks a ton for this post. I was scratching my head for hours to get this issue fixed. Thanks again for saving my time.
It worked gr8. Thnx.
Thanks, this helped me a lot
Hi Even I have a simlar situation and your solutions is not working for me. I have class library in which i have referenced a web service and app.config is updated correctly. And in my WPF application im trying to use this class. WPF application config is also updated properly. but still i get this error when the prxoy object is created.
Thanks! I found this post after spending two frustrating hours on more complex fixes. I am still pretty weak on the underlying architecture. This helped me understand the wiring better.