views:

104

answers:

1

I have an AJAX-enabled WCF service and everything works fine with the ajax endpoint. Now I want to add another wsHttpBinding endpoint that corresponds to another interface that is subset of the AJAX interface (i.e. I want only specific methods to be exposed in WSDL). I have a class that implements both interfaces but when I visit the service address MyService.svc?wsdl it contains metadata about both services. How can I configure WCF to do this? The service is hosted in a website application in IIS.

Maybe I don't really get the concept and a service corresponds to an interface so if I have 2 interfaces I have 2 services (i.e. 2 .svc files).

+2  A: 

The issue here is that the WSDL/MEX endpoints that WCF exposes provide information about a service, not a specific contract. Thus, they expose metadata about all contracts supported by the service.

You can certainly split them into different .svc files (and thus exposing what appears to be multiple services, each one with a different contract).

I haven't found the WSDL-generation in WCF to be too useful for REST-like services (including AJAX stuff), and it often can get in the way, so sometimes I just turn it off.

tomasr
I don't care about the WSDL for the AJAX stuff. I want the WSDL for the SOAP stuff but I cannot hide the other methods that are only there for AJAX calls.
Stilgar
Oh then by all means expose them as "separate" services (two .svc files) and just keep a common implementation underneath. It's cleaner that way.
tomasr
Thank you. I was going that way but I was wondering if there is a better, more WCF-y way.
Stilgar