views:

1465

answers:

2

I have a web forms app running on IIS7 Classic. It utilizes .asmx style web services for a client side heavy portion of the site.

We have been tasked with layering in "friendly urls" and decided to use the new Asp.net routing. We have a rule in IIS to map all requests to the aspnet_isapi.dll, which yields this declaration in our web.config (system.webServer/hanlers):

<add name="asp.net routing" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />

But now routing breaks our .asmx webservice requests (of the form http://example.com/blah.asmx/SomeMethod). Any request to a web service leaves us with the always fun:

Failed to Execute URL.
[HttpException (0x80004005): Failed to Execute URL.]
System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6.BeginExecuteUrl(String url, String method, String childHeaders, Boolean sendHeaders, Boolean addUserIndo, IntPtr token, String name, String authType, Byte[] entity, AsyncCallback cb, Object state) +2004885
System.Web.HttpResponse.BeginExecuteUrlForEntireResponse(String pathOverride, NameValueCollection requestHeaders, AsyncCallback cb, Object state) +393
System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) +223
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8677954
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155

Putting this line in our routes setup:

routes.Add(new Route("{service}.asmx/{*pathInfo}", new StopRoutingHandler()));

still leaves us with the "Failed to execute URL" exception. I know the route is matching because of this:

public sealed class DieHandler : IRouteHandler
{
 #region IRouteHandler Members

 public IHttpHandler GetHttpHandler(RequestContext requestContext)
 {
  throw new NotImplementedException();
 }

 #endregion
}
routes.Add(new Route("{service}.asmx/{*pathInfo}", new DieHandler()));

With that route in place instead of "Failed to Execute URL" I see "Method not implemented" like I would expect.

My suspicion is that our * -> aspnet_isapi.dll is wreaking havoc, since I haven't found anyone else doing this while scouring google.

Thanks for any insights in advance.

+1  A: 

You need to add requireAccess="None" to the handler in web.config, ie:

<add name="aspnet_isapi 32-bit" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv2.0,bitness32" />

This allows the files to be processed correctly

Glenn Slaven