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

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.