I have an WCF service which I am trying to configure so that it exposes 2 endpoints, refering to different functionalities, under different URLs.
What I want to have is Service1, exposing methods A, B, C, and Service2, exposing methods D, E. I want to be able to browse both localhost/WebServiceName/Service1/Service.svc and localhost/WebServiceName/Service2/Service.svc.
Other applications referencing localhost/WebServiceName/Service1/Service.svc should see only the interface containing the methods A, B and C. They should not see anything regarding Service2 interface. And for Service2 likewise.
So far I have defined two interfaces in my WCF service, I_Service1 and I_Service2.
I have added two endpoints in my web.config like so:
<endpoint address="http://localhost/WebServiceName/Service1/" binding="wsHttpBinding" contract="WebServiceName.I_Service1" bindingConfiguration="Binding1" />
<endpoint address="http://localhost/WebServiceName/Service2/" binding="wsHttpBinding" contract="WebServiceName.I_Service2" bindingConfiguration="Binding2" />
The suggestion of using full address in the enpoint comes from here: Multiple endpoints under IIS
But still, I can't browse localhost/WebServiceName/Service1/Service.svc. I receive:
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
I can successfully browse localhost/WebServiceName/Service.svc and the wsdl includes methods A, B, C, D, E. But this should be wrong in the behaviour I want.
Is there something that I have missed?
UPDATE: Following this article http://allen-conway-dotnet.blogspot.ro/2011/09/exposing-multiple-binding-types-for.html I created two different contract services for those endpoints. But currently I am seing only Service1 when I browse it. Service2 apparently does not exist (HTTP 404 error related issues appear).
The configuration looks like:
<services>
<service behaviorConfiguration="WebServiceName.ServiceBehavior1" name="WebServiceName.Service1">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="Binding1"
contract="WebServiceName.I_Service1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/WebServiceName/Service1/Service.svc" />
</baseAddresses>
</host>
</service>
<service behaviorConfiguration="WebServiceName.ServiceBehavior2" name="WebServiceName.Service2">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="Binding1"
contract="WebServiceName.I_Service2" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/WebServiceName/Service2/Service.svc" />
</baseAddresses>
</host>
</service>
</services>