Archive for August, 2009

Could not load file or assembly ‘apache fop.net’ or one of its dependencies

By George Zheng

When we deploy one of our web sites to a 64 bit web server, we get following error: “Could not load file or assembly ‘apachefop.net’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

This web site is using fop.net to generate the PDF for printing. After investigation, we realize the fop.net can’t run on IIS with 64-bit version of ASP.NET.

IIS 6.0 on a 64-bit hardware supports both the 32-bit version of ASP.NET and the 64-bit version of ASP.NET. However IIS 6.0 does not support running both modes at the same time on a 64-bit version of Windows.  Here are the steps to run the 32-bit version of ASP.NET 2.0 on IIS:

  1. Click Start, click Run, type cmd, and then click OK.
  2. Type the following command to enable the 32-bit mode:
    cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1
  3. Type the following command to install the version of ASP.NET 2.0 (32-bit) and to install the script maps at the IIS root and under:
    %SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
  4. Make sure that the status of ASP.NET version 2.0.50727 (32-bit) is set to Allowed in the Web service extension list in Internet Information Services Manager.

Useful Links

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