Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Endpoint Error: Could not find default endpoint element

So here is my problem. I have a client that is utilized within a service, and when I test said service using the built-in test host in Visual studio, all of the service contracts are available. But, when I try to test one of the service contracts, Visual studio spits out the following error

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

Now, I know the immediate and obvious answer is to check my config to make sure that my endpoint is correct, but that is the thing, it is correct. I checked both the web.config for the service implementing the client, and the app.config for the client. Both endpoints are correct(at least I think they are).

Here is the web.config endpoint:

<endpoint address="http://testServiceRepo/TestServices/TestService.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITestService"
            contract="TestServiceReference.ITestService"
            name="BasicHttpBinding_ITestService" />

Here is the app.config endpoint:

<endpoint address="http://testServiceRepo/TestServices/TestService.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITestService"
            contract="TestServiceReference.ITestService"
            name="BasicHttpBinding_ITestService" />

The endpoints are the exactly the same, and they both reference TestServiceReference.ITestService. So, I am at a loss here. What would you guys suggest?

Thanks for any help!

like image 451
MuffinTheKid Avatar asked Jul 27 '15 19:07

MuffinTheKid


1 Answers

This error can arise if you are calling the service in a class library and calling the class library from another project. In this case you will need to include the WS configuration settings into the main projects app.config if its a winapp or web.config if its a web app. how you are testing it ? Did you tried to create client proxy/class using svcutil and then test these methods. it also generates require configuration in output,config file which you can use.

like image 181
DJay Avatar answered Sep 30 '22 04:09

DJay