Freigeben über


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

Question:

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?

Thanks!

Answer:

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.

//David

Comments

  • Anonymous
    October 31, 2006
    PingBack from http://www.nateirwin.net/2006/10/31/64bit+Server+ASPNET+11+Amp+ASPNET+20.aspx

  • Anonymous
    July 23, 2007
    I found this blog troubleshooting why SQL2005 reporting services wasn't working.  Some program installation (hmm, FRx report server for Great Plains 9.0???) had set the Enable32bitAppOnWin64 to TRUE but even switching this back to FALSE did not cure the issue.  64bit .NET 2.0 had to be re-registered with IIS http://support.microsoft.com/kb/894435 has the answer...

  • Anonymous
    April 28, 2008
    The comment has been removed

  • Anonymous
    July 28, 2008
    I have a 32 bit web service. But this does not work on x64.  How should i deploy it? I have tried to enable32bitappon win64 but there are other x64 applications. Hence this is not an option. How do I make my application x64?

  • Anonymous
    July 28, 2008
    Princy - if your application is .Net, then it is bitness agnostic and make sure you compile for platform "Any" instead of strictly x86 or x64. If your application is platform specific binary, then you need to recompile it to target the x64 platform. //David

  • Anonymous
    April 30, 2009
    I had this issue and used the following article to resolve my issue: How to switch between the 32-bit versions of ASP.NET 1.1 and the 64-bit version of ASP.NET 2.0 on a 64-bit version of Windows http://support.microsoft.com/kb/894435 C:>cscript %SYSTEMDRIVE%inetpubadminscriptsads util.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 0 Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. Enable32bitAppOnWin64           : (BOOLEAN) False C:>%SYSTEMROOT%Microsoft.NETFramework64v2.0.50 727aspnet_regiis.exe -i Start installing ASP.NET (2.0.50727). ................... Finished installing ASP.NET (2.0.50727).

  • Anonymous
    August 25, 2009
    Hi Wn trying to install i also got the error as x64.exe not a valid Win32 application And nw i got solution which i put into my blog http://javaerrorsinfo.blogspot.com/2009/08/error-x64exe-not-valid-win32.html

  • Anonymous
    January 08, 2010
    Hi, I have Windows 7 x64 and my web application (website) is also a x64 compatible (created using VS2005). When I try to add it; it gives me "%1 is not a valid Win32 application" exception. If I run the website with enable32bitapponwin64 True; application works perfectly as a x86 process but I want to run it as x64 process by setting enable32bitapponwin64 False since my app is x64 compatible. I tried this command; but still no luck. %SYSTEMROOT%Microsoft.NETFramework64v2.0.50727aspnet_regiis.exe -i Please suggest the solution. Am I missing any step? Thanks, Gdhar gaims1@gmail.com

  • Anonymous
    February 04, 2010
    I have windows 2003 server and am running the iis that comes with it.  I want to run all 32 bit isapi dlls and have turned the enable32bitapponwin64 true, but i still get the "%1 is not a valid Win32 application"  I do not need .net, nor ever want to use it, but i tried installing both 2.0 and 1.1 and following http://support.microsoft.com/kb/894435 but doing that only makes IIS not work at all.  Still looking for a solution...  I just want to run 32 bit programs on my 64 bit machine.