Geo
Geo

Reputation: 8771

How we run a .NET 32-bit application in a 64-bit Windows server?

We are installing a third party application in one of our 64-bit 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 an error:

System.BadImageFormatException: is not a valid Win32 application.

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

How to get around this situation? For everyone that wants to know more information:

  1. The application is running fine in a 32-bit test server.
  2. IIS version 6
  3. using SQL Server 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

Upvotes: 3

Views: 4734

Answers (4)

Joel Coehoorn
Joel Coehoorn

Reputation: 416159

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

To fix it, you need to create a manifest file to tell the app to run in 32-bit 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

Upvotes: 4

jussij
jussij

Reputation: 10580

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.

Upvotes: -1

AnthonyWJones
AnthonyWJones

Reputation: 189555

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

Upvotes: -1

Lars Mæhlum
Lars Mæhlum

Reputation: 6102

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

Upvotes: 3

Related Questions