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

前端 未结 2 1038
我在风中等你
我在风中等你 2020-11-29 07:22

I\'m trying to use extension-less / .svc-less WCF services. Can anyone else confirm or deny the issue I\'m experiencing?

I use routing in code, and do this in Appli

2条回答
  •  心在旅途
    2020-11-29 08:12

    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

提交回复
热议问题