Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have created a WCF service application for my project.I have hosted this service on iis.when i try to configure this service in the client machine ,i get an error in the place where i create an instance for the service and call the service methods.The client to which Im trying to cofigure my service is a c# Class Library ,and the framework is framework 4.0.

the error is as follows:


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

Pls lemme know where i have gone wrong.

Any help regarding this error would be greatly appreciated .

Thanks in advance
Posted

Hi,

First add ServiceReference in c# Class Library. Then, try the below code in c# Class Library:

//Create object of the Binding
Binding binding = new BasicHttpBinding();
//Create endpointAddress of the Service
EndpointAddress endpointAddress = new
EndpointAddress("http://localhost/TestService.svc?wsdl");
//Create Client of the Service
TestServiceClient serviceClient = new TestServiceClient(binding, endpointAddress);
//Call Service method using ServiceClient
serviceClient.GetData();

Thanks.
 
Share this answer
 
Comments
Member 11898501 21-Aug-15 2:15am    
Thanks it worked.
Member 12861448 8-Jun-19 8:27am    
getting this error after apply this http://vkalra.in/WCF_SERVICE/RestServiceImpl.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Check these
1. StackOverFlow[^]
and
2. StackOverFlow[^]
Solutions.

They have accepted answers...
 
Share this answer
 
v3

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