Home > WCF > Could not find default endpoint element that references contract ‘Your Service’ in the ServiceModel client configuration section.

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.

kick it on DotNetKicks.com

About these ads
Categories: WCF Tags:
  1. May 21, 2010 at 2:25 pm | #1

    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.

    • Sanjoy
      October 10, 2011 at 7:11 pm | #2

      gr8……………

  2. Sanjay Sutar
    May 3, 2011 at 11:50 pm | #3

    Thanks a ton for this post. I was scratching my head for hours to get this issue fixed. Thanks again for saving my time.

  3. Shahan
    February 22, 2012 at 8:46 pm | #4

    It worked gr8. Thnx.

  4. jansenmartijnartijn
    February 27, 2012 at 2:02 am | #5

    Thanks, this helped me a lot :)

  5. Raghavendra
    March 5, 2012 at 7:51 pm | #6

    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.

  6. TJ
    April 7, 2012 at 7:19 am | #7

    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.

  7. Amjad Majeed
    May 27, 2013 at 11:55 pm | #8

    Thank you so much , it solved my problem.

  8. selvaa
    December 10, 2013 at 10:37 pm | #9

    Great shot

  9. Abds
    February 21, 2014 at 10:17 pm | #10

    Awesome!!! its working , Thanks a lot

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 155 other followers

%d bloggers like this: