I have a WCF service that is running on IIS 8.5. I consumed and Tested the service in a Windows forms project and in a console application project and works fine! But I am not able to consume the web service from a class library project in Visual Studio 2013.
Could not find default endpoint element that references contract 'bindSignalR.bindSinalRService' 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.
I looked to the configuration files of the Windows Forms Project (that works) and the Class Library Project but I can’t find the difference. What am I doing wrong?
The web.Config of the service is:
<configuration>
<system.web>
<compilation targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="bindSignalRService.Web.bindSinalRService.customBinding0">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="bindSignalRService.Web.bindSinalRService">
<endpoint address="" binding="customBinding" bindingConfiguration="bindSignalRService.Web.bindSinalRService.customBinding0"
contract="bindSignalRService.Web.bindSinalRService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
</configuration>
The app.config in the Windows form (this one works fine!) app:
<configuration>
<configSections>
</configSections>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_bindSinalRService">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://slascvm042:49904/bindSinalRService.svc"
binding="customBinding" bindingConfiguration="CustomBinding_bindSinalRService"
contract="bindNewEventService.bindSinalRService" name="CustomBinding_bindSinalRService" />
</client>
</system.serviceModel>
</configuration>
But when I try to consume the WCF service in a Class Library Application I got the error: Could not find default endpoint element that references contract 'bindSignalR.bindSinalRService' 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.