Running an ASP.NET website on 64-bit
I'm in the process of migrating our old Windows Server 2003 boxes (32 bit) to Windows Server 2008 (64 bit) boxes and have several ASP.NET websites that have to be moved. After setting up the websites on the new box, I got this error:
"Could not load file or assembly 'System.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format."
One way of solving the problem was to enable the option "Enable 32-Bit Applications" on the IIS application pool, to force the worker process to run in 32 bit mode. This works, but is no good, because I want the app to run in 64 bit mode.
After some poking around, and by using a tool called corflags.exe, I found out that my webapps had a separate copy of System.Data.dll in their bin folders, which was loaded instead of the installed 64 bit versions of System.Data.dll. The problem was fixed by deleting these dlls from the webapp's bin folder. Tada!
Some more great info on the same topic can be found in the great blog post 32bitness and 64bitness and migrating DasBlog on IIS7 and ASP.NET under Vista64 written by Scott Hanselman.



