“Could not find default endpoint element” exception

I added a new web service to my console application and I got an exception from the System.ServiceModel namespace:

 The exception was: “Could not find default endpoint element that references contract ‘A_RECORD_LOCK.B_RECORD_LOCK’ 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.”

 Looking through the system.serviceModel in the app.config file, I saw that there were no entries for my new web service. So I added them by copying another binding and remaining the appropriate properties:




          <binding name=”RECORD_LOCK”>

              <textMessageEncoding maxReadPoolSize=”64″ maxWritePoolSize=”16″ messageVersion=”Soap11″ writeEncoding=”utf-8″>

                  <readerQuotas manyManyProperties=”true” />


              <httpTransport lotsOfSettingsCutOut=”true” />


        <endpoint address=”http://www.someserver.com/record_lock&#8221; binding=”customBinding” bindingConfiguration=”RECORD_LOCK” contract=”A_RECORD_LOCK.A_RECORD_LOCK” name=”RECORD_LOCK” />




 But the error persisted. After a few other tries, I decided to actually read the error message carefully. (This tends to help solve problems.) The message stated it couldn’t find the contract “A_RECORD_LOCK.B_RECORD_LOCK”. I looked at the contract property in the endpoint element and saw “A_RECORD_LOCK.A_RECORD_LOCK”. Doh! They were different. After renaming the contract to the correct value, it worked.

Be careful of those contract spelling, kids.

  1. Leave a comment

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: