2

I am getting the following error if I try to run the ASP.NET 4.0 website in a 64 bit machine with Enable 32 bit Applications flag set to false. (I have to set that to False, If I set it to true its working fine). > "Could not load file or assembly 'Common.BL' or one of its dependencies. An attempt was made to load a program with an incorrect format.

And in the project properties the Target of Build is set to Any CPU.

Still I am getting the same error.

Can you guys please help me resolving this error. Anyhelp would be appreciated.

Thanks. Sameer.

user788312
  • 439
  • 2
  • 10
  • 22

2 Answers2

1

I'd focus on the "or one of its dependencies" portion of the error. Are you referencing a 32-bit assembly or one compiled for a different platform?

Randolpho
  • 55,384
  • 17
  • 145
  • 179
0

Ensure Common.BL is 64 bit. You can check this fairly easily. Check this out for help:

How to determine if a .NET assembly was built for x86 or x64?

Let's use that as a starting point, post the results. If it is a 32 bit and you are on IIS 6, then ALL of IIS must be set to run in 32 bit mode. If you are in IIS 7 then you can set a specific app pool to run in 32 bit mode. Ensure you compile your code for 32 bit though.

Community
  • 1
  • 1
Adam Tuliper
  • 29,982
  • 4
  • 53
  • 71
  • @Randolpho..Yes The Common.BL has the following properties Version : v4.0.30319 CLR Header : 2.5 PE : PE32 CorFlags : 3 ILONLY : 1 32 BIT : 1 Signed : 0 – user788312 Jun 08 '11 at 16:15
  • then you need to do what I mentioned above depending on your IIS version. – Adam Tuliper Jun 08 '11 at 16:17
  • If you are running IIS 6 see: http://support.microsoft.com/kb/894435 for iis 7 see: http://learn.iis.net/page.aspx/201/32-bit-mode-worker-processes/ or for an app pool level (not server level) see: http://blogs.msdn.com/b/rakkimk/archive/2007/11/03/iis7-running-32-bit-and-64-bit-asp-net-versions-at-the-same-time-on-different-worker-processes.aspx – Adam Tuliper Jun 08 '11 at 16:25
  • what specifically fixed your issue? – Adam Tuliper Sep 07 '11 at 19:34