2012-09-28 53 views
2

我通過nuget將common.logging.log4net添加到了我的visual studio 2012解決方案中。common.logging - 在應用程序配置文件中找到重定向

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, 版本= 2.1.1.0,文化=中性公鑰= af08829b84f0328e'或一個依賴的 之一。找到的程序集清單定義 與程序集引用不匹配。 (從HRESULT異常: 0x80131040)] System.Reflection.RuntimeAssembly._nLoad(的AssemblyName 文件名,字符串的代碼庫,證據assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark & stackMark,IntPtr的pPrivHostBinder, 布爾throwOnFileNotFound,布爾forIntrospection,布爾 suppressSecurityChecks)+ 0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(的AssemblyName assemblyRef,證據assemblySecurity,RuntimeAssembly reqAssembly, StackCrawlMark & stackMark,IntPtr的pPrivHostBinder,布爾 throwOnFileNotFound,布爾forIntrospection,布爾 suppressSecurit yChecks)210
System.Reflection.RuntimeAssembly.InternalLoad(字符串assemblyString, 證據assemblySecurity,StackCrawlMark & stackMark,IntPtr的 pPrivHostBinder,布爾forIntrospection)242
System.Reflection.RuntimeAssembly.InternalLoad(字符串assemblyString, 證據assemblySecurity ,StackCrawlMark & stackMark,布爾 forIntrospection)+17 System.Reflection.Assembly.Load(String assemblyString)+35
System.Web.Configuration.CompilationSection。LoadAssemblyHelper(字符串 的AssemblyName,布爾starDirective)+122

它正在尋找Common.Logging版本= 2.1.1.0,它找不到,因爲它沒有加載。現在,當我調試應用程序時,我看到以下異常,這有點不同:

LOG:此綁定在默認加載上下文中啓動。

LOG:使用應用程序配置文件: C:\工作區\ FTM \ APPS \ TM \ TM.Web \ web.config中

LOG:使用主機配置文件: C:\ WINDOWS \ Microsoft.NET \ Framework64 \ v4.0.30319 \ aspnet.config

LOG:使用來自 的機器配置文件C:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ config \ machine.config。

LOG:此時策略未應用於引用(私有, 自定義,部分或基於位置的程序集綁定)。

LOG:嘗試新的URL 文件下載:/// C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET文件/根/ e97e0952/56ab271f/Common.Logging.DLL 。

LOG:嘗試新的URL 文件下載:/// C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET 文件/根/ e97e0952/56ab271f/Common.Logging/Common.Logging.DLL。

LOG:試圖下載新的URL file:/// C:/Workspaces/FTM/Apps/TM/TM.TM/Web.bin/Common.Logging.DLL。

LOG:使用應用程序配置文件: C:\工作區\ FTM \ APPS \ TM \ TM.Web \ web.config中

LOG:使用主機配置文件: C:\ WINDOWS \ Microsoft.NET \ Framework64 \ v4.0.30319 \ aspnet.config

LOG:使用來自 的機器配置文件C:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ config \ machine.config。

LOG:在應用程序配置文件中找到的重定向:2.0.0.0 重定向到2.1.1.0。

LOG:後政策參考:Common.Logging,版本= 2.1.1.0, 文化=中性公鑰= af08829b84f0328e

LOG:新的URL 文件試圖下載:/// C:/ Windows的/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/e97e0952/56ab271f/Common.Logging.DLL。

LOG:嘗試新的URL 文件下載:/// C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET 文件/根/ e97e0952/56ab271f/Common.Logging/Common.Logging.DLL。

LOG:試圖下載新的URL file:/// C:/Workspaces/FTM/Apps/TM/TM.TM/Web.bin/Common.Logging.DLL。警告: 比較程序集名稱導致不匹配:次版本 ERR:未能完成程序集設置(hr = 0x80131040)。探測 終止。

堆棧跟蹤:

[FileLoadException:未能加載文件或程序集 'Common.Logging' 或它的一個依賴。找到的程序集清單定義 與程序集引用不匹配。 (從HRESULT異常: 0x80131040)]

[FileLoadException:未能加載文件或程序集Common.Logging, 版本= 2.1.1.0,文化=中性公鑰= af08829b84f0328e'或一個依賴的 之一。找到的程序集清單定義 與程序集引用不匹配。 (從HRESULT異常: 0x80131040)] System.Reflection.RuntimeAssembly._nLoad(的AssemblyName 文件名,字符串的代碼庫,證據assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark & stackMark,IntPtr的pPrivHostBinder, 布爾throwOnFileNotFound,布爾forIntrospection,布爾 suppressSecurityChecks)+ 0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(的AssemblyName assemblyRef,證據assemblySecurity,RuntimeAssembly reqAssembly, StackCrawlMark & stackMark,IntPtr的pPrivHostBinder,布爾 throwOnFileNotFound,布爾forIntrospection,布爾 suppressSecurit yChecks)210
System.Reflection.RuntimeAssembly.InternalLoad(字符串assemblyString, 證據assemblySecurity,StackCrawlMark & stackMark,IntPtr的 pPrivHostBinder,布爾forIntrospection)242
System.Reflection.RuntimeAssembly.InternalLoad(字符串assemblyString, 證據assemblySecurity ,StackCrawlMark & stackMark,布爾 forIntrospection)17 System.Reflection.Assembly.Load(字符串 assemblyString)35
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串 的AssemblyName,布爾starDirective)122

[ConfigurationErrorsException:無法加載文件或程序集 'Common.Logging,Version = 2.1.1.0,Culture = neutral, PublicKeyToken = af08829b84f0328e'或其依賴項之一。位於程序集清單定義中的 與程序集 的引用不匹配。 (從HRESULT異常:0x80131040)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串 的AssemblyName,布爾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(字符串 preStartInitListPath)203
System.Web.Compilation。 BuildManager.ExecutePreAppStart()+152
System.Web.Hosting.HostingEnvironment。初始化(ApplicationManager AppManager的,IApplicationHost APPHOST,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel,異常appDomainCreationException)1151

[HttpException(0X80004005):無法加載文件或組件 「Common.Logging,版本= 2.1 .1.0,Culture = neutral, PublicKeyToken = af08829b84f0328e'或其依賴項之一。位於程序集清單定義中的 與程序集 的引用不匹配。 (從HRESULT異常:0x80131040)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext的上下文)12881540 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext的上下文) 159 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest WR, HttpContext上下文)+12722601

版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.17929

不知道爲什麼它的嘗試(根據日誌)

湯姆

+0

也許這個職位可以幫助你:http://stackoverflow.com/questions/2236772/quartz-net-and-common-logging-using-log4net – MUG4N

回答

3

這條線,我認爲在這個問題提示重定向到2.1.1.0:

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

檢查被告知它試圖加載版本2.1.1.0隨時隨地的東西組裝重定向你的應用程序配置文件(app.config)中要求的版本2.0.0.0。

相關問題