System.Web.HttpException: Failed to Execute URL

What Happen?

Recently in our company me and my colleage converted our ASP.NET application from v1.1 to v2.0. The conversion process was as smooth as apple-pie, and as soon as everything checks out just fine on our development machines(winxp), we decided to upload the app. to our testenvironment(win2k3).

After the upload, we noticed that some of the images stopped stopped showing up. “STRANGE”. The first thought that crossed our minds was: WTF?!?

Requesting a normal.gif file resulted in a DNS-error page.

Luckily for us, soon after the exception-emails started showing up in our mailbox. They contained the following:

request: http://www.myserver.net/private/Images/logos/myImage.gif


Failed to Execute URL.

type

System.Web.HttpException

stack trace

  • at System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6.BeginExecuteUrl(String url, String method, String childHeaders, Boolean sendHeaders, Boolean addUserIndo, IntPtr token, String name, String authType, AsyncCallback cb, Object state)
  • at System.Web.HttpResponse.BeginExecuteUrlForEntireResponse(String pathOverride, NameValueCollection requestHeaders, AsyncCallback cb, Object state)
  • at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
  • at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute
  • at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Searching for this exception didn't return any results from MSDN or Google... so we were on our own...

Because we were using a custom httphandler (read more about that here) for gif images the first thing to look at is the file extension registration in IIS. These checked out fine and had the same configuration as our developmachines.

The only difference between the test environment and our development environment was the OS (and with that the IIS version).

After some puzzling we found source of evil.

How to reproduce the error:

  1. On win2003 using IIS6, create a.NET 2.0 (v2.0.50727) application.
  2. In the IIS configuration -> application configuration (see image), register that.gif files are handled by the.NET framework
  3. Fireup your favourite browser and request a.gif file from your newly created application

On IIS5 (eg. winxp) all works just fine.

!

What solved my problem:

Adding 1 line to the web.config solved my problem:

<httpHandlers>

     <add verb="*" path="*.gif" type="System.Web.StaticFileHandler" />

<httpHandlers>

Apparently.net2.0 on IIS6 has some probs handling files which extension is registered in IIS, but where in the application no HTTPHandler is configured.

Hope this helps somebody out there:P

peace,

Joost Ploegmakers

This article is part of the GWB Archives. Original Author: Joost Ploegmakers

New on Geeks with Blogs