c# - Log4Net : "Could not load file or assembly ' log4net, 错误 Version=1.2.10.0,Culture=neutral,PublicKeyToken=null' 或其依赖项之一”

标签 c# asp.net asp.net-mvc asp.net-mvc-4 log4net

当尝试运行供应商提供的 MVC 示例以试用 API 时,出现以下错误:

[StructureMapConfigurationException: StructureMap configuration failures: Error: 170 Source: Registry: StructureMap.Configuration.DSL.Registry, StructureMap, Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223 Unable to find the exported Type's in assembly Groupdocs.Web.UI.Comparison, Version=2.0.5205.21794, Culture=neutral, PublicKeyToken=c9073b8a6a9c78c8. One or more of the assembly's dependencies may be missing.

Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044) System.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044) File name: 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=null'
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) at System.Reflection.RuntimeAssembly.GetExportedTypes() at StructureMap.Graph.TypePool.<>c__DisplayClass2.<.ctor>b__0(Assembly assembly)

似乎专门与 Log4net 有关,但我已经获得了项目和版本 (1.2.10) 的正确引用,有趣的是,当我从另一台机器上尝试同一个项目时它可以工作,所以不确定实际问题是什么。 我检查了 GAC,没有 log4net 引用。

最佳答案

错误提示:“需要强名称程序集

我认为您应该向您使用的 log4net 添加一个强命名 key ,或者从您的应用程序中删除一个强命名 key 。

关于c# - Log4Net : "Could not load file or assembly ' log4net, 错误 Version=1.2.10.0,Culture=neutral,PublicKeyToken=null' 或其依赖项之一”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24078827/

相关文章:

asp.net-mvc - 您在哪里进行验证?模型、 Controller 或 View

c# - 中间件中的路由 Controller 和 Action

C# 每 30 天运行一次代码

c# - 将自定义 header 添加到 excel 文件

c# - Sys.WebForms.PageRequestManagerParserErrorException : The message received from the server could not be parsed

c# - HttpWebRequest .GetResponse 抛出 WebException 'The operation has timed out'

asp.net-mvc - 我应该在 ASP.Net MVC、NHibernate、LINQ、EF 中使用什么?

c# - 使用异步等待在 ForEach 中获取 "The connection does not support MultipleActiveResultSets"

c# - 用户代码未处理Dll get Exception的C#用户定义的异常处理错误

c# - C# 是否有一种很好的方法来遍历范围内的每个整数,减去其中的 1?