How to configure IIS 7 on 64-bit Windows 7 to run 32-bit .NET 4 C# code

How to configure IIS 7 on 64-bit Windows 7 to run 32-bit .NET 4 C# code

Old forum URL: forums.lhotka.net/forums/t/9038.aspx


JonStonecash posted on Friday, June 04, 2010

I am getting the error "Could not load file or assembly 'CN.NET.Authorization' or one of its dependencies. An attempt was made to load a program with an incorrect format." when I attempt to access my CSLA assemblies via WCF.  I have marked all of my code as X86.  I am using the ASP.NET V4.0 application pools; I have also tried the ASP.NET V4.0 Classic as well. I am using VS2010.

Everything works just fine when IIS is not involved. 

What do I do to get IIS to "play nice" with my code? 

Jon Stonecash

JonStonecash replied on Friday, June 04, 2010

I figured this out with some help from my co-workers.  You have to configure the IIS application pools to allow 32 bit code.  here is how to do it:

  1. Bring up IIS Manager.
  2. Open up the tree on the left to the point where you can see the Application Pools.
  3. Click on the Application Pools.  You will see a grid of the available application pools.
  4. Click on the application pool that you want to allow 32-bit code for.
  5. Select the "Advanced Setting..." link on the right-hand side of the display.
  6. Flip the "Enable 32-bit Applications" value to true.
  7. Say OK to everything.
  8. Repeat for any other app pools.

Jon Stonecash

Copyright (c) Marimer LLC