Note that there are some explanatory texts on larger screens.

plurals
  1. POASMX not generating WSDL when using Custom IHttpHandlerFactory
    text
    copied!<p>I am implementing a dynamic ASMX web service via a custom HttpHandler, and my web service has recently stopped generating WSDL automatically. When I use ?WSDL on the asmx url, I get the following error:</p> <pre><code>System.InvalidOperationException: XML Web service description was not found. at System.Web.Services.Protocols.DiscoveryServerProtocol.WriteReturns(Object[] returnValues, Stream outputStream) at System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[] returnValues) at System.Web.Services.Protocols.WebServiceHandler.Invoke() </code></pre> <p>This worked fine a while ago, so I'm wondering if there's a file permission problem somewhere.</p> <p>A Google search does not return any reference to this particular situation.</p> <p>I doubt that my code is relevant to the problem; it has not changed:</p> <pre><code>[WebService(Description = "...", Namespace = "...")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ToolboxItem(false)] public class MyWebService : System.Web.Services.WebService { [WebMethod] void MyWebMethod() {} } public class VirtualWebServiceFactory : IHttpHandlerFactory { public IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated) { WebServiceHandlerFactory wshf = new WebServiceHandlerFactory(); MethodInfo coreGetHandler = wshf.GetType().GetMethod("CoreGetHandler", BindingFlags.NonPublic | BindingFlags.Instance); IHttpHandler handler = (IHttpHandler)coreGetHandler.Invoke(wshf, new object[] { typeof(MyWebService), context, context.Request, context.Response }); return handler; } } </code></pre> <p>Decompiling System.Web.Services.Protocols.DiscoveryServerProtocol.WriteReturns() reveals that it looks up the XML service description in a dictionary created somewhere else.</p> <p>I was hoping that someone familiar with the DiscoverServerProtocol etc. might know under what circumstances the XML service description might fail to be built.</p> <p>The following works just fine:</p> <pre><code>ServiceDescriptionReflector reflector = new ServiceDescriptionReflector(); reflector.Reflect(typeof(MyWebService), "..."); </code></pre> <p>Navigating to MyWebService.asmx shows all the functions and allows testing them. But using ?WSDL gives the exception above.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload