Error "System.BadImageFormatException" when trying to run Visual COBOL ASP.NET web application under Local IIS web server



Customer has an ASP.NET Web Application developed in Visual COBOL 2.1 for Visual Studio 2010. This is running on a Windows 7 64-bit computer.

It runs fine when the debugging tab is set to ues the Visual Studio Development Web Server. Customer changed the debugging tab to Use Local IIS Web Server instead and now it reports the following error:

Could not load file or assembly 'progname' or one of its dependencies. An attempt was made to load a program with an incorrect format. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.BadImageFormatException: Could not load file or assembly 'progname' or one of its dependencies.

What is causing this?


The problem can occur because you have built your web application as x86 (32-bit) and you are running this on a 64-bit operating system. The default in IIS 7 when running on a 64-bit operating system is to only allow 64-bit applications to run. In order to run a 32-bit application under IIS you need to enable 32-bit support.

This can be done under the Advanced settings for the Application Pool under which your application is running.

Comment List