Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Comments
Sangramsingh Pawar 6-Sep-12 7:40am    
paste your config file

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.
 
Share this answer
 
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.
try following
C#
YourServiceClient service_obj = new  YourServiceClient("EndPointName");
 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900