Wcftestclient - can I connect to a specific endpoint?

This should be a simple question.

I cannot connect to a specific endpoint using the WCFTestClient tool. I have a service configuration. eg:

<service name="CO.Services.SvcTest"> <endpoint address="ep1" binding="basicHttpBinding" bindingConfiguration="" bindingNamespace="http://api.CO.com/Services/Tester/ep1" contract="CO.Services.ISvcTest" /> <endpoint address="ep2" binding="basicHttpBinding" bindingConfiguration="" bindingNamespace="http://api.CO.com/Services/Tester/ep2" contract="CO.Services.ISvcTest_v2" /> <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" name="" contract="IMetadataExchange" /> </service> 

If I pass "http: // localhost: 2659 / Tester.svc / ep1" or "http: // localhost: 2659 / Tester.svc / ep2", I get "Can't get metadata from ...", but if I pass' http: // localhost: 2659 / Tester.svc, it works and shows me both endpoints.

Does anyone know what I am missing?

EDIT1 : is this possible?

+4
source share
1 answer

This is the correct behavior .

In WCF, by default, service metadata is served at the service’s base address.

If you host your service in a custom process, you can customize the URL of the base address or even add new ones using the baseAddresses section. If you host the service in IIS, which seems to be your case, then the base address is always the URL of the .svc file.

EDIT: If you need two completely separate endpoints, you need to create two service implementations , one for each contract, and configure them using different elements in the configuration file. As long as the endpoints are part of the same service, you can only get metadata from the base address of the service, which in your case is the URL of the .svc file.

+3
source

Source: https://habr.com/ru/post/1390626/


All Articles