Basically, looking into the solutions to get a FlatWSDL, I found the following:
- http://weblogs.thinktecture.com/cweyer开发者_如何学C/2007/05/improving-wcf-interoperability-flattening-your-wsdl.html
- http://wcfextras.codeplex.com/
The WCF Extras looks interesting, but might be too much for what I need (which is simply a FlatWSDL). So, the first link points out how to do that, except here's the thing. If you host your service within IIS, where would this code go?
I know this is an old question (over a year old!) but as I've been playing with this today, I thought it would be worth trying to clear up this question...
The answer is from here http://blogs.msdn.com/b/dotnetinterop/archive/2008/09/23/flatten-your-wsdl-with-this-custom-servicehost-for-wcf.aspx
As described on that page you need to create 3 classes - FlatWsdl, FlatWsdlServiceHost and FlatWsdlServiceHostFactory. Then for hosting in IIS, add a reference to the Factory class into the .svc markup file...
<%@ ServiceHost Language="C#"
Factory="{YourNamespace}.FlatWsdlServiceHostFactory"
Service="{YourNamespace}.WcfService1"%>
Also, it looks like this will be solved in WCF 4.5 :) http://blogs.msdn.com/b/piyushjo/archive/2011/10/05/what-s-new-in-wcf-4-5-flat-wsdl-support.aspx
ServiceHostFactory is the answer, described here: http://msdn.microsoft.com/en-us/library/aa702697.aspx
精彩评论