Friday, October 7, 2011

Failed to Execute Url

Failed to Execute URL Exception.
Isapi Rewrite and Asp.Net 4 on IIS6.
Failed to Execute URL asp.net 4 IIS 6 Windows Server 2003.

Currently working in ITweetLive, I encountered what seemed to be a massive problem while trying to upgrade my website from .Net 3.5 to .Net 4.

First thing first.
Our website was compiled with .Net 3.5 up until couple of days ago when I wanted to start working with .Net 4.  A short conversion made by Visual Studio 2010 and then recompile.  The localhost works like a charm.

Next step was to create a different application pool in IIS6 (I named it ".Net4") which will be only for the websites who have been converted to .Net 4 framework.
After that it was simply assign the new application pool to the website and change its version to .Net 4, as simple as it sounds.

But, and here came the real problem, when trying to reach the website's root without the "default.aspx" I encountered a "Failed to Execute URL" exception.

After couple of hours digging the web, I found what I wanted in the form of a great post made by Rhys Godfrey.

Long story short, these are the steps you need to do if:
  1. You got an "Failed to Execute URL" exception.
  2. You are running on Windows Server 2003 and IIS6.
  3. You're using the Isapi Rewrite.
  4. You just updated you're website from .Net 2 (and it's versions: 3, 3.5) to .Net 4.
Steps to do:

1. Type "REGEDIT" on the run window and click enter.


2. Go to this directory: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\4.0.30319.0 

3. Create a new DWORD value and name it "EnableExtensionlessUrls".
4. Set "EnableExtensionlessUrls" to 0.  This will disable extensions URL behavior.
5. Save the registry value and close the editor.
6. Type iisreset on the run window and click enter.
    Now you have a functioning website using both .Net 4 and Isapi Rewrite on Windows Server 2003 and IIS6.

    Hope it helped,
    Elad Shalom,
    CTO at ITweetLive.com