C#无法加载文件或程序集'Microsoft.Practices.EnterpriseLibrary.Logging

时间:2016-03-18 14:08:19

标签: c# asp.net .net

我正在使用ASP / C#网页。我在将页面移动到服务器时提交页面时收到此错误,但在我在本地计算机上测试时却没有收到该错误。我试着查了几件事,但在我看来,我没有得到一个非常明确的答案。请让我知道如何解决这个问题..

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].

1 个答案:

答案 0 :(得分:0)

来源:Exception saying missing Microsoft.Practices.EnterpriseLibrary.Common.dll.

  

问题是 -

     

未标记企业库程序集参考属性   "复制本地"

     

[如果您正在使用Visual Studio或类似的东西:]选择您正在使用的实际第三方dll,然后转到属性   并将CopyLocal设置从False更改为True。这应该   解决你的问题。

     

您需要添加二进制的引用。将二进制文件复制到某处   您安装EnterpriseLibrary的系统并将其添加为   参考

     

您需要参考您的图书馆。放在上面是件好事   在您打算使用任何项目时,项目中的依赖项文件夹   你项目中的第三方dll。尝试添加引用   依赖文件夹,因此当您将项目发送到另一台机器时   您不必担心安装和查找单个DLL。