Using WCF 3.5 and the FlatWsdl EndpointBehavior from Christian Weyer, I was able to get a single flat WSDL file for my WCF services without any <import>
directives.
Now with WCF 4, this doesn't work anymore for some reason.
I have tried everything described in a lot of blog entries including using the WcfExtras behavior extension.
They all either refer to Chr. Weyers solution or recommend the WcfExtras. I also made sure I specified the same namespace for the binding, ServiceContract and ServiceBehavior.
In the custom service host, when the FlatWsdlExtension is about to be injected, the Description.Endpoints collection is always empty. I tried to configure my service endpoint with or without an adress, so far without luck.
What do I need to do in order to get a single flat WSDL for my WCF 4 service?
Thanks for any answers.
I was having this exact problem. After several attempts today, I finally got it to work by doing the following:
Make sure you specify exactly the same namespace attribute in: ServiceContract, ServiceBehavior, and bindingNamespace (.config->services/service/endpoint section).
Be mindful of this problem, which I did encounter at one point.
Download this zip file and include FlatWsdl/Extensions: FlatWsdl.cs, FlatWsdlServiceHost.cs, and FlatWsdlServiceHostFactory.cs somewhere in your project.
Make sure you specify the fully-qualified classname for your version of FlatWsdlServiceHostFactory.cs (minus .cs of course) in the ServiceHost Factory attribute of your .svc file.
I tried WcfExtras among other things today -- there may be more or less to it, but these steps finally got me going. Good luck!
[edit]