views:

1171

answers:

4

We are installing a third party application in one of our 64bit windows servers. This application apparently was build with the compiler option set to choose the platform at run time. When we run the application it gives us a

System.BadImageFormatException: is not a valid Win32 application.

Errrors. I have seen in forums from the MSDN that in order to fix this error I have to build the application set to 32bit and that way it will run fine on a 64bit server. I check on other StackOverflow links Other Posts.

Does anyone how to get around this situation? For everyone that wants to know more info:

  1. The application is running fine in a 32bit test server.
  2. IIS version 6
  3. using SQL EXPRESS 2005
  4. On the Web Service Extension there are both Framework64\v2.0.50727\aspnet_isapi.dll
  5. and Framework\v2.0.50727\aspnet_isapi.dll
+4  A: 

One possibility is that the app depends on an unmanaged dll that needs to be run in 32bit mode. Since the default "AnyCPU" .Net build checks the platform automatically the .Net part of the program is starting in 64bit mode. This will cause the calls to the 32bit-only unmanaged dll to fail.

To fix it, you need to create a manifest file to tell the app to run in 32bit mode. I've never needed to do that myself, so I can't provide instructions and a quick google search hasn't (yet) turned up anything.

[Update]
See if this link helps:
http://msdn.microsoft.com/en-us/library/aa374191.aspx

Joel Coehoorn
The manifest are not present in the wwwroot folder. Maybe for security purposes. Maybe I cannot find them.
Geo
There may not be any manifest yet- you may have to create it.
Joel Coehoorn
+2  A: 

I'm not sure this will help, but check it out:
http://msdn.microsoft.com/en-us/library/ms164699(VS.80).aspx

Lars Mæhlum
A: 

The details of the question is a little confusing but I'll take a punt.

You need to the version aspnet_regiis.exe found in the Framework\v2.0.50727\ folder against the web site where this code is running

AnthonyWJones
A: 

One thing that might work is making sure the .Net application is flagged as a true 32 bit application by changing the target CPU details.

In the Visual Studio 2005 you can do this by going to the project Properties and in the Build section set the Platform Target to x86 and not Any APU which is the default.

jussij