Bootstrap

Exception about "Could not load file or assembly Namespace.Components' or one of its dependencies."

   由于asp.net的权限问题,所以如果在site中使用了Assembly.Load()方法,那么很容易报这个错误。我的整个解决方法如下:

1.执行 c:/winnt/microsoft.net/framework/[version number]/aspnet_regiis.exe -i

2. Assembly.Load()使用的参数应该是fullname,类似于 EMC.CMA.Objectiva.SharePoint.Components, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4ad833eee0b6bbc4

3.  如果还是不行,那么给C:/windows 赋予 aspnet execute and read permition.

再要不行,我投降,没辙了.

参考文章:http://social.msdn.microsoft.com/Forums/en-US/clr/thread/9e4d9631-6144-461e-9c83-94a3e2cd3560/

 

 

 

 

[Resolved] Could not load file or assembly 'XXXXX' or one of its dependencies. An attempt was made to load a program with an incorrect format.

I have recently switched my development environment from 32-bit to 64-bit by installing Windows Server 2008 64-bit and modify it to be used as workstation as described here http://www.win2008workstation.com/ and I'm really amazed with it’s performance.

I have faced the problem mentioned in the post title when I'm trying to run a web application included in one of our development solutions.

couldnot load

I have checked the project which has the DBHelper as it’s output and I’ve discovered that the project configured to target x86 platform and as I'm working with 64-bit it will have such ‘incorrect format’ error.

How to fix it :

Simply follow the steps below :

  • open project properties window.
  • select Build tab
  • Change it to ‘Any CPU’
  • Save your changes.
  • Compile your project and run :)

image

Filed under: .NET , Visual Studio 2008 , Windows Server 2008 64-bit
;