Exposing only the interface in WSDL in WCF, rather then the service
I have a service contract ICalc, and I want to expose a WSDL through the MEX endpoint, which will only describe the ICalc contract, i.e. will contain only the portType element, without the service elemen开发者_运维百科t.
Is there a way to do that in WCF?It sounds like what you want is to expose an abstract WSDL instead of a concrete WSDL. As far as I know, there is no built-in way in WCF to accomplish this.
One thing I thought about is that it may be possible to accomplish this by manually removing the <service> and <binding> elements from the generated WSDL file in a custom IWsdlExportExtension extension. However, I was unable to get it to work after a few tests (if I removed the service, WCF would just show the HTML help screen when the WSDL was requested).
There might be a way to get it though, so maybe give it a try.
精彩评论