Thursday, June 16, 2011

Could not find default endpoint element that references contract 'x' in the ServiceModel client

Scenario :

I was creating a WCf client to test the services . After creating client proxy and testing the services i bumped into below error. It seems the configuration in my app.config was not correct.

ERROR:
{System.InvalidOperationException: Could not find default endpoint element that references contract 'x' 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.


Resolution :
When you generate client using the svcutil.exe , an output.xml is generated. This file contains the end point configuration information . Take the configuration from this file and add it to app.config. Service should work without configuration issue assuming your code is not erroneous ;-)


1 comment:

Anonymous said...

I have the same problem, but did not use svcutil.exe to generate anything for the client. I added a service reference in my client project. Where can I get the XML?

Thank you.

Gray Failures: What is it and how to detect one?

If you are reading this article , i guess you are curious to know about gray failures and different methods to detect gray failures.  Hopefu...