4

This should be a straightforward question.

I am unable to connect to a specific endpoint using WCFTestClient tool. I have a service config. like this:

<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 "Cannot obtain Metadata from..." but if I pass 'http://localhost:2659/Tester.svc it works and shows me both endpoints.

Does anyone know what am I missing?

EDIT1: Is this even possible?

Learner
  • 3,009
  • 3
  • 33
  • 61

1 Answers1

3

That's the correct behavior.

In WCF a service's metadata is served at the service's base address by default.

If you're hosting your service in a custom process, you can customize the URL of the base address or even add new ones using the baseAddresses configuration section. If you're hosting 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 want two completely separate endpoints, then you will have to create two service implementations, one for each contract, and configure them with different elements in your configuration file. As long as the endpoints are part of the same service, you will only be able to retrieve the metadata from the service's base address, which in your case is the URL of the .svc file.

Learner
  • 3,009
  • 3
  • 33
  • 61
Enrico Campidoglio
  • 47,702
  • 11
  • 112
  • 146
  • Ok, maybe I put the question wrong... then how can I do it? :) – Learner Jan 12 '12 at 11:51
  • @Cristi What is it exactly you want to achieve? – Enrico Campidoglio Jan 12 '12 at 11:58
  • I want to use 2 different endpoints for versioning purposes. So I wanted to know how to load only one endpoint at a time using WCFTestTool. – Learner Jan 12 '12 at 12:03
  • 1
    @Cristi If you want two completely separate endpoints, then you will have to **create two service implementations**, one for each contract, and configure them with different `` elements in your configuration file. As long as the endpoints are part of the same service, you will only be able to retrieve the metadata from the service's base address, which in your case is the URL of the `.SVC` file. – Enrico Campidoglio Jan 12 '12 at 12:28
  • I see, so the answer to my question is: "not possible"... Thanks Enrico! – Learner Jan 12 '12 at 12:50
  • @Cristi I'm glad I could help :) – Enrico Campidoglio Jan 12 '12 at 12:51