Powered by Blogger.

Sunday, March 2, 2014

Could not find default endpoint element that references contract 'ServiceReference1.Service1' in the ServiceModel client configuration section



In this post we will discuss how to resolve one wcf error which comes when no endpoint defined. Also you can check some articles on:

- Populate dataset with data adapter and XML in Asp.Net

- Call stored procedure in Asp.Net using C#.Net

- Database provider factory not set for the static DatabaseFactory

Full Error message:

Could not find default endpoint element that references contract 'ServiceReference1.Service1' 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.

Cause:
This error usually comes when there is multiple project. In the start up form, we have to define this end point.

Solution:
We need to define the end point in the startup form like below. We are here using one Windows application.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_Service1" sendTimeout="00:05:00" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:58199/ARHost.svc" binding="basicHttpBinding"
          bindingConfiguration="BasicHttpBinding_Service1" contract="ServiceReference1.IARService"
          name="BasicHttpBinding_Service1" />
    </client>
  </system.serviceModel>
</configuration>

Hope Now the error will not come.



0 comments

Post a Comment