简体   繁体   中英

FileLoadException: Could not load file or assembly 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0, Culture=neutral, PublicKeyToken=null'

Im having a WebApplication that runs in vs2010 but the target framework is set as 2.0. The application uses enterprise library. when I execute the application in my local I getting an error

Required permissions cannot be acquired.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Security.Policy.PolicyException: Required permissions cannot be acquired.

and in the stack trace I'm getting error

FileLoadException: Could not load file or assembly 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.

If is set the target framework as 4.0 the code executes fine. I have tried the following steps :

  1. set the 'Copy to output directory' in the objectbuilder dll property as copy always (earlier it was do not copy)

  2. tried adding the trust tag with trust level="high" originUrl="" and also trust level="low" originUrl=""

copied the below tags from the machine.config of 4.0 to machine.config of 2.0

section name="fullTrustAssemblies" type="System.Web.Configuration.FullTrustAssembliesSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>

section name="partialTrustVisibleAssemblies" type="System.Web.Configuration.PartialTrustVisibleAssembliesSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>

but still getting the error. Please let me know what could be the issue..

问题解决了..我单独拿了EL dll,给它起了一个好名字并在GAC中注册了程序集。现在代码可以正常工作了。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM