I am adding a WCF client via “Add Service Reference” to the Class project with Visual Studio 2012. However I am getting the well known error:
Could not find default endpoint element that references contract ‘Service1.IService1′ 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.
The steps I followed was : (1) Create the Service1.cs and output.config via svcutil.exe, (2) Add service reference I am giving reference namespace as “MyFirstWcfWebServiceReference”. (3) add your existing Service1.cs file to the project. (4) in app.config Removed “MyFirstWcfWebServiceReference” and keep only IService1 in contract, (6) Build Project.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="WCFServiceBinding" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/webiste/WebService.svc"
binding="basicHttpBinding" bindingConfiguration="WCFServiceBinding"
contract="IService1" name="WCFServiceBinding" />
</client>
</system.serviceModel>
</configuration>