简体   繁体   中英

C# Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Logging

I am working with an ASP/C# web page. I am getting this error when submitting the page when I moved it to a server, but was not getting it when I was testing it on my local machine. I tried to look up a few things, but I was not getting a very clear answer in my opinion. Please let me know how to fix this..

Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=e44a2bc38ed2c13c' or one of its dependencies. The system cannot find the file specified. 
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.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=e44a2bc38ed2c13c' or one of its dependencies. The system cannot find the file specified.

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=e44a2bc38ed2c13c' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

source: Exception saying missing Microsoft.Practices.EnterpriseLibrary.Common.dll.

The problem is -

the enterprise library assembly reference propertiesare not marked "copy local"

[If you're using Visual Studio or something similar:] select the actual third party dll you are using, then go to properties and change the CopyLocal setting from False to True. This should resolve your issue.

You need to add the reference of binary. Copy the binary somewhere on your system from where EnterpriseLibrary installed and add it as reference.

You will need reference of your library. It is good that you place on dependency folder in your project when ever you are going to use any third party dll in your project. Try adding reference from that dependency folder, so when you ship your project in another machine you don't need to worry for installing and finding individual dll.

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