Click here to Skip to main content
12,630,137 members (25,765 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#3.0 C# .NET WCF
im trying to consume a wcf service from a client application. Thw WCF services is hosted in web. After i add the service reference to the project, all the proxy gets generated.

when im tryin to access the proxy class methods., im gettin gthe below error:

An endpoint configuration section for contract 'XService.XServicePortType' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.

In app.config, i removed custom binding end points. I have just one http end point.

please suggest.

Thanks in advance.
Posted 6-Sep-12 1:39am
Comments
Sangramsingh Pawar 6-Sep-12 7:40am
   
paste your config file
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Well, I think that the error message accurately describes the situation. The service exposes the contract on several endpoints.
Basically when creating the new client object, use the overloaded constructor (the one with the endpoint name). You fetch the name you want from the app.config.
  Permalink  
Comments
prince_arjun 6-Sep-12 7:58am
   
I also tried using the overloaded operator like:
YourServiceClient service_obj = new YourServiceClient("EndPointName");,
still i get the same error above.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

try following
YourServiceClient service_obj = new  YourServiceClient("EndPointName");
  Permalink  
Comments
prince_arjun 6-Sep-12 7:59am
   
I also tried using the overloaded operator like:
YourServiceClient service_obj = new YourServiceClient("EndPointName");,
still i get the same error above.

My config file:
<system.servicemodel> <bindings> <basichttpbinding> xxxxxxx <client> <endpoint address="x" binding="basicHttpBinding" bindingconfiguration="xServiceSoap11Binding" contract="xServicePortType" name="xHttpSoap11Endpoint"> <endpoint address="y" binding="basicHttpBinding" bindingconfiguration="ySoap11Binding" contract="yServicePortType" name="yHttpSoap11Endpoint">
Sangramsingh Pawar 6-Sep-12 8:01am
   
if you paste here web.config file we will find some solution on it.
prince_arjun 6-Sep-12 8:08am
   
<system.servicemodel>
<bindings>
<basichttpbinding> abcd


<client>
<endpoint address="x" binding="basicHttpBinding" bindingconfiguration="xServiceSoap11Binding" contract="xServicePortType" name="xHttpSoap11Endpoint">
<endpoint address="y" binding="basicHttpBinding" bindingconfiguration="ySoap11Binding" contract="yServicePortType" name="yHttpSoap11Endpoint">

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.161205.3 | Last Updated 6 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100