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.