ServiceRoute + WebServiceHostFactory kills WSDL generation? How to create extensionless WCF service with ?wsdl

Wow, do I feel dumb.

I should have been hosting my service with ServiceHostFactory, NOT WebServiceHostFactory.

As soon as I moved back to code from config… and swapped to this line of code:

RouteTable.Routes.Add(new ServiceRoute("Data", new ServiceHostFactory(), typeof(DataDips)));

I was in business with an extensionless URL serving up WSDL and help pages.

It’s too bad I wasted so much time on this. It was an accident that I was using WebServiceHostFactory, but there’s no disclaimer on the factory page in MSDN about the reduced functionality. (I would argue that removing WSDL makes sense, but removing the Help pages does not as they could simply provide an attribute in config to rename the ‘Help’ page should there be a REST operation with that name… sigh).

There is a note in the WebServiceHost docs
http://msdn.microsoft.com/en-us/library/system.servicemodel.web.webservicehost.aspx

Leave a Comment