HOWTO: Diagnose One Cause of "%1 is not a valid Win32 application" on IIS6 on 64bit Windows


I have a new development server that i put together on a Windows 2003 64 bit machine. I also have SQL Server 2005 and Developers Studio 2005 and 2003 installed on this machine. I have executed the "Enable32bitAppOnWin64 1" command, as per the instructions when installing Developers Studio. I am unable to server ASPX pages from this machine. I started with a "500 - Internal Server Error" but am now getting a "%1 is not a valid Win32 application. "

Under Application Configuration, ASPX is pointed to C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll.

I have tried Googling this but haven't found anything.

Any suggestions?



Back in this blog entry, I looked at one of many ways to arrive at the dreaded "503 Service Unavailable" - trying to load a 32bit ISAPI Filter DLL into a 64bit w3wp.exe fails because Windows WOW64 compatibility requires DLL and its loading process to have the same bitness. This question arrives at the problem the other way - trying to load a 64bit ISAPI DLL into a 32bit w3wp.exe - which also fails the same OS requirement of the DLL matching bitness of its loading process.

To make a long story short - there is a compatibility shim which triggers that recommendation for VS.Net 2003 Installation on 64bit Windows. However, there is a 50/50 chance that its recommendation is wrong - it totally depends on what you are trying to do and the order you do them - but we cannot change the .Net 1.1 installer, nor control the order of your installation, nor read your mind. So, we basically had to choose between 50% of users getting errors without ever seeing a warning dialog, or 50% getting errors after following instructions in the warning dialog - and we chose the latter.

In your case, you managed to configure IIS6 to:

  • Run worker processes in 32bit WOW64 mode (that's what Enable32bitAppOnWin64 1 means) AND
  • Load 64bit ASP.Net ISAPI DLL into those processes (that's what C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll means)

The bitness mismatch causes the "%1 is not a valid Win32 application." error when IIS6 tries and fails to load the ASP.Net ISAPI DLL handler.

My guess is that you first installed VS.Net 2005 (which set up 64bit Application Mappings), then installed VS.Net 2003 (which requires Enable32bitAppOnWin64), and upon following the advice, IIS6 stopped working.

The correct solution? It completely depends on what you are trying to accomplish and what applications you want to run, and there may be no solution. Here are some relevant decision points:

  • If you want to run ASP.Net 1.1, you MUST run worker processes in 32bit WOW64 mode because it only has a 32bit DLL.
  • If you want to use FPSE to deploy VS Solutions, you MUST run worker processes in 32bit WOW64 mode because it only has a 32bit DLL (through an ironic twist, there is a 64bit FPSE for Itanium but NOT 64bit FPSE for x64 - and I disregard Itanium availability/usage). Using UNC to deploy VS Solutions is bitness agnostic.
  • ASP.Net 2.0 can run in either 32bit or 64bit mode. You just have to remember to run the aspnet_regiis.exe from the appropriate Framework/Framework64 folder so that it can tweak the Application Mappings appropriately.
  • If you are using additional components/applications, make sure their bitness matches that of your configured worker process.
  • You switch worker process bitness with Enable32bitAppOnWin64, and it is done globally across IIS6.

In general, my advice for 64bit Windows users is that if you want to run 64bit Windows, then only run 64bit applications on it, especially server applications like ASP.Net. Otherwise, you have to learn and understand how a 32bit server application triggers the WOW64 compatibility layer and its interactions with an IIS6 worker process. If you do not do this, you will end up with either 500s or 503s - there are literally gazillion ways to trigger issues and hence very few documented solutions. I cannot document all those problem instances, but I CAN give you advice on how it works and how failures come about - so that you can apply the advice to your situation and determine what is right for you.

Good luck.