How do I resolve “%1 is not a valid Win32 application”?

余生长醉 提交于 2019-12-10 12:55:38

问题


Environment:
Windows Server 2003 R2 Enterprise 64bit, SP2
.NET framework is supposedly installed (2.0 SP2, 3.0 SP2, 3.5 SP1)

I say "supposedly" because they are listed as installed under Add/Remove programs. I'm not sure it's properly installed, because the "ASP.NET" tab isn't added to any of the sites in IIS.

In the IIS Web Service Extensions section, I have both "ASP.NET v2.0.50727" (Allowed), and "ASP.NET v2.0.50727 (32-bit)" (Prohibited).

The site in question has script-execute enabled.

Problem:

I created a super-simple ASP.NET/C# website: Default.aspx with a label id="Label1", and a code-behind with: Label1.text = "Hello World"; and the error I'm getting is:

%1 is not a valid Win32 application.


回答1:


Have you tried running:

aspnet_regiis -i

from the command line?




回答2:


Also check your application pool. In a 64-bit environment, you may need to set "Enable 32-bit applications" in Advanced Settings.




回答3:


I had "%1 is not a valid Win32 application." error message because my PATH environment variable was messed up as well. It included this garbage from a python install:

%PYTHON_HOME%;
%PYTHON_HOME%\Scripts;



回答4:


I had a similar error with IIS7 on Windows Server 2008 64 Bits.

The fusion log is not of any help here, and it turned out that in my case there was a third party assembly that was referencing a 32 Bits only assembly or native dll. (Xceed to be precise)

To find which assembly is being loaded by the 64 bits runtime :

  • Attach the VS2008 debugger on w3wp.exe process that matches your application pool
  • Intercept all exceptions (Menu Debug / Exceptions / check all "Common Language Runtime Exceptions").
  • Make sure your application is reloaded completely (by modifying the web.config, for instance).
  • When the System.BadImageFormatException exception is raised, look for a assembly name in the stack trace viewer window.

Remember that all assemblies placed in the bin directory are loaded, regardless of their actual implication in the application.




回答5:


I had "%1 is not a valid Win32 application." error message because my PATH environment variable was messed up. Well, more specifically, the PATH itself had nothing wrong with it. Instead, I had accidentally created a file named "C:\Program" that was used instead of "C:\Program Files\" for path lookup. The accidental creation of "C:\Program" was a result of calling Notepad++ on the command line for C:\Program Files\test.txt (without quotation marks), so Notepad++ thought I was trying to edit a file called "C:\Program" and created the file for me.




回答6:


I had this problem. I deployed an .EXE to a Windows 2003 that doesn't support .NET 4.5. I rebuilt the program with .NET 4 and it worked.



来源:https://stackoverflow.com/questions/185042/how-do-i-resolve-1-is-not-a-valid-win32-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!