首页 文章

common.logging - 在应用程序配置文件中找到重定向

提问于
浏览
2

我通过nuget将common.logging.log4net添加到我的visual studio 2012解决方案中 .

common.logging.log4net ver . - 2.0.1 common.logging ver . - 2.0.0 log4net - ver . 1.2.10

当我在本地构建/运行它时,我通过浏览器看到以下异常:

无法加载文件或程序集“Common.Logging”或其依赖项之一 . 定位的程序集的清单定义与程序集引用不匹配 . (来自HRESULT的异常:0x80131040)描述:在执行当前Web请求期间发生了未处理的异常 . 请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息 . 异常详细信息:System.IO.FileLoadException:无法加载文件或程序集“Common.Logging”或其依赖项之一 . 定位的程序集的清单定义与程序集引用不匹配 . (来自HRESULT的异常:0x80131040)堆栈跟踪:[FileLoadException:无法加载文件或程序集'Common.Logging'或其依赖项之一 . 定位的程序集的清单定义与程序集引用不匹配 . (来自HRESULT的异常:0x80131040)] [FileLoadException:无法加载文件或程序集'Common.Logging,Version = 2.1.1.0,Culture = neutral,PublicKeyToken = af08829b84f0328e'或其依赖项之一 . 定位的程序集的清单定义与程序集引用不匹配 . (来自HRESULT的异常:0x80131040)] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)0 System.Reflection.RuntimeAssembly . InternalLoadAssemblyName(AssemblyName assemblyRef,Evidence assemblySecurity,RuntimeAssembly reqAssembly,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)210 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString,Evidence assemblySecurity,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,Boolean forIntrospection) 242 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString,Evidence assemblySecurity,StackCrawlMark&stackMark,Boolean forIntrospection)17 System.Reflection.Assembly.Load(String assemblyString)35 System . Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName,Boolean starDirective)122

它正在寻找Common.Logging Version = 2.1.1.0,它找不到,因为它没有被加载 . 现在,当我调试应用程序时,我看到以下异常,这有点不同:

日志:此绑定在默认加载上下文中启动 . 日志:使用应用程序配置文件:C:\ Workspaces \ FTM \ Apps \ TM \ TM.Web \ web.config日志:使用主机配置文件:C:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ aspnet.config日志:使用C:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ config \ machine.config中的计算机配置文件 . 日志:此时策略未应用于引用(私有,自定义,部分或基于位置的程序集绑定) . 日志:尝试下载新的URL文件:/// C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files / root / e97e0952 / 56ab271f / Common.Logging.DLL . 日志:尝试下载新的URL文件:/// C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files / root / e97e0952 / 56ab271f / Common.Logging / Common.Logging.DLL . 日志:尝试下载新的URL文件:/// C:/Workspaces/FTM/Apps/TM/TM.Web/bin/Common.Logging.DLL . 日志:使用应用程序配置文件:C:\ Workspaces \ FTM \ Apps \ TM \ TM.Web \ web.config日志:使用主机配置文件:C:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ aspnet.config日志:使用C:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ config \ machine.config中的计算机配置文件 . 日志:在应用程序配置文件中找到重定向:2.0.0.0重定向到2.1.1.0 . 日志:后策略引用:Common.Logging,Version = 2.1.1.0,Culture = neutral,PublicKeyToken = af08829b84f0328e日志:尝试下载新的URL文件:/// C:/Windows/Microsoft.NET/Framework64/v4.0.30319 / Temporary ASP.NET Files / root / e97e0952 / 56ab271f / Common.Logging.DLL . 日志:尝试下载新的URL文件:/// C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files / root / e97e0952 / 56ab271f / Common.Logging / Common.Logging.DLL . 日志:尝试下载新网址文件:/// C:/Workspaces/FTM/Apps/TM/TM.Web/bin/Common.Logging.DLL . 警告:比较程序集名称导致不匹配:次要版本错误:无法完成程序集的设置(hr = 0x80131040) . 探测终止 . 堆栈跟踪:[FileLoadException:无法加载文件或程序集'Common.Logging'或其依赖项之一 . 定位的程序集的清单定义与程序集引用不匹配 . (来自HRESULT的异常:0x80131040)] [FileLoadException:无法加载文件或程序集'Common.Logging,Version = 2.1.1.0,Culture = neutral,PublicKeyToken = af08829b84f0328e'或其依赖项之一 . 定位的程序集的清单定义与程序集引用不匹配 . (来自HRESULT的异常:0x80131040)] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)0 System.Reflection.RuntimeAssembly . InternalLoadAssemblyName(AssemblyName assemblyRef,Evidence assemblySecurity,RuntimeAssembly reqAssembly,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)210 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString,Evidence assemblySecurity,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,Boolean forIntrospection) 242 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString,Evidence assemblySecurity,StackCrawlMark&stackMark,Boolean forIntrospection)17 System.Reflection.Assembly.Load(String assemblyString)35 System . Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName,Boolean starDirective)122 [ConfigurationErrorsException:无法加载文件或程序集'Common.Logging,Version = 2.1.1.0,Culture = neutral,PublicKeyToken = af08829b84f0328e'或其依赖项之一 . 定位的程序集的清单定义与程序集引用不匹配 . (来自HRESULT的异常:0x80131040)] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName,Boolean starDirective)12761078 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()503 System.Web.Configuration.AssemblyInfo.get_AssemblyInternal()142 System .Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)334 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath)203 System.Web.Compilation.BuildManager.ExecutePreAppStart()152 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParameters hostingParameters,PolicyLevel policyLevel,Exception appDomainCreationException)1151 [HttpException(0x80004005):无法加载文件或程序集'Common.Logging,Version = 2.1.1.0,Culture = neutral,PublicKeyToken = af08829b84f0328e'或其中一个依赖ncies . 定位的程序集的清单定义与程序集引用不匹配 . (来自HRESULT的异常:0x80131040)] System.Web.HttpRuntime.FirstRequestInit(HttpContext context)12881540 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)159 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext context)12722601版本信息: Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.17929

不知道为什么它试图重定向到2.1.1.0(根据日志)

汤姆

1 回答

  • 3

    我认为这条线暗示了这个问题:

    LOG: Redirect found in application configuration file: 2.0.0.0 redirected to 2.1.1.0.
    

    检查应用程序配置文件(app.config)以获取程序集重定向,该程序集会指示它在请求版本2.0.0.0的任何时候尝试加载版本2.1.1.0 .

相关问题