“Failed to load data access DLL, 0x80004005”这个问题可能有很多种原因,本文描述的一种情况就是客户的站点的.Net Framework的版本和本地调试机的版本不一致,以及解决方案。
废话少说,直接开工。(蓝色粗体命令为解决问题的命令)
# Windbg加载dump文件后的一些文件信息
Microsoft (R) Windows Debugger Version 6.3.9600.17298 X86 Copyright (c) Microsoft Corporation. All rights reserved. Loading Dump File [C:\dump\EMSClientApp (2).DMP] User Mini Dump File with Full Memory: Only application data is available Symbol search path is: *** Invalid *** **************************************************************************** * Symbol loading may be unreliable without a symbol search path. * * Use .symfix to have the debugger choose a symbol path. * * After setting your symbol path, use .reload to refresh symbol locations. * **************************************************************************** Executable search path is: Windows 7 Version 7601 (Service Pack 1) MP (4 procs) Free x86 compatible Product: WinNt, suite: SingleUserTS Machine Name: Debug session time: Tue Sep 1 01:37:14.000 2015 (UTC + 8:00) System Uptime: 3 days 8:54:07.007 Process Uptime: 0 days 0:24:25.000 ................................................................ ................................................................ ............... Loading unloaded module list ...................................................... *** ERROR: Symbol file could not be found. Defaulted to export symbols for ntdll.dll - *** ERROR: Symbol file could not be found. Defaulted to export symbols for kernel32.dll - eax=000024f9 ebx=0017d7dc ecx=00000200 edx=00000104 esi=00000002 edi=00000000 eip=774c70b4 esp=0017d78c ebp=0017d828 iopl=0 nv up ei pl zr na pe nc cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246 ntdll!KiFastSystemCallRet: 774c70b4 c3 ret |
# 加载debug extension
0:000> .loadby sos clr |
# 看一下调用栈,轻车熟路.
0:000> !clrstack ********************************************************************* * Symbols can not be loaded because symbol path is not initialized. * * * * The Symbol Path can be set by: * * using the _NT_SYMBOL_PATH environment variable. * * using the -y * using .sympath and .sympath+ * ********************************************************************* PDB symbol for clr.dll not loaded Failed to load data access DLL, 0x80004005 Verify that 1) you have a recent build of the debugger (6.2.14 or newer) 2) the file mscordacwks.dll that matches your version of clr.dll is in the version directory or on the symbol path 3) or, if you are debugging a dump file, verify that the file mscordacwks_ 4) you are debugging on supported cross platform architecture as the dump file. For example, an ARM dump file must be debugged on an X86 or an ARM machine; an AMD64 dump file must be debugged on an AMD64 machine. You can also run the debugger command .cordll to control the debugger's load of mscordacwks.dll. .cordll -ve -u -l will do a verbose reload. If that succeeds, the SOS command should work on retry. If you are debugging a minidump, you need to make sure that your executable path is pointing to clr.dll as well. |
# 这个, 好像没按套路出牌…老老实实按提示做
0:000> .cordll -ve -u -l CLRDLL: C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscordacwks.dll:4.0.30319.34014 f:8 doesn't match desired version 4.0.30319.01 f:8 CLRDLL: Unable to find mscordacwks_x86_x86_4.0.30319.01.dll by mscorwks search CLRDLL: Unable to find 'mscordacwks_x86_x86_4.0.30319.01.dll' on the path CLRDLL: Unable to find clr.dll by search Cannot Automatically load SOS CLRDLL: ERROR: Unable to load DLL mscordacwks_x86_x86_4.0.30319.01.dll, Win32 error 0n2 CLR DLL status: ERROR: Unable to load DLL mscordacwks_x86_x86_4.0.30319.01.dll, Win32 error 0n2 |
# 提示信息比较明确,就是运行时环境的版本和调试机的版本不一致。于是我们从客户机上面把.Net Framework的目录拷贝过来。
#(当然,按照网上的说法,只要拷贝三个dll就可以了)
#拷完继续…
0:000> .exepath+ C:\Framework\v4.0.30319 Executable image search path is: C:\Framework\v4.0.30319 Expanded Executable image search path is: c:\framework\v4.0.30319 ************* Symbol Path validation summary ************** Response Time (ms) Location OK C:\Framework\v4.0.30319 0:000> .sympath+ srv*c:\symbols*http://msdl.microsoft.com/download/symbols Symbol search path is: srv*c:\symbols*http://msdl.microsoft.com/download/symbols Expanded Symbol search path is: srv*c:\symbols*http://msdl.microsoft.com/download/symbols ************* Symbol Path validation summary ************** Response Time (ms) Location Deferred srv*c:\symbols*http://msdl.microsoft.com/download/symbols |
#嗯
0:000> .reload ................................................................ ................................................................ ............... Loading unloaded module list ...................................................... 0:000> .symfix+ c:\symbols 0:000> .reload /f .*** ERROR: Module load completed but symbols could not be loaded for EMSClientApp.exe ... Press ctrl-c (cdb, kd, ntsd) or ctrl-break (windbg) to abort symbol loads that take too long. Run !sym noisy before .reload to track down problems loading symbols. ................*** WARNING: Unable to verify checksum for mscorlib.ni.dll ....*** ERROR: Symbol file could not be found. Defaulted to export symbols for safemon.dll - ..................*** WARNING: Unable to verify checksum for System.ni.dll .*** WARNING: Unable to verify checksum for System.Drawing.ni.dll .*** WARNING: Unable to verify checksum for System.Windows.Forms.ni.dll ..*** WARNING: Unable to verify checksum for System.Core.ni.dll .*** WARNING: Unable to verify checksum for Microsoft.VisualBasic.ni.dll .*** WARNING: Unable to verify checksum for System.ServiceModel.ni.dll .*** WARNING: Unable to verify checksum for SMDiagnostics.ni.dll .*** WARNING: Unable to verify checksum for System.Runtime.DurableInstancing.ni.dll .*** WARNING: Unable to verify checksum for System.Configuration.ni.dll .*** WARNING: Unable to verify checksum for System.Xml.ni.dll .*** WARNING: Unable to verify checksum for System.Transactions.ni.dll ..*** WARNING: Unable to verify checksum for System.Runtime.Serialization.ni.dll ..*** WARNING: Unable to verify checksum for System.IdentityModel.ni.dll ....... ...*** WARNING: Unable to verify checksum for System.Deployment.ni.dll .*** WARNING: Unable to verify checksum for System.Web.ni.dll .........*** WARNING: Unable to verify checksum for System.Data.ni.dll .............*** WARNING: Unable to verify checksum for System.Runtime.Remoting.ni.dll .*** WARNING: Unable to verify checksum for System.WorkflowServices.ni.dll .*** WARNING: Unable to verify checksum for System.ServiceModel.Web.ni.dll .*** WARNING: Unable to verify checksum for System.ServiceModel.Discovery.ni.dll .*** WARNING: Unable to verify checksum for System.ServiceModel.Activities.ni.dll .*** WARNING: Unable to verify checksum for System.ServiceModel.Routing.ni.dll .*** WARNING: Unable to verify checksum for System.ServiceModel.Channels.ni.dll ....*** WARNING: Unable to verify checksum for System.Xaml.ni.dll ..*** WARNING: Unable to verify checksum for System.Management.ni.dll ....................*** ERROR: Symbol file could not be found. Defaulted to export symbols for slc.dll - ...... ...*** ERROR: Symbol file could not be found. Defaulted to export symbols for ZSDNT5UI.DLL - .*** ERROR: Symbol file could not be found. Defaulted to export symbols for ZSDDM.DLL - .*** ERROR: Symbol file could not be found. Defaulted to export symbols for ZSPOOL.DLL - .*** ERROR: Symbol file could not be found. Defaulted to export symbols for ZGDI.DLL - .*** ERROR: Symbol file could not be found. Defaulted to export symbols for ZTAG.DLL - .*** ERROR: Symbol file could not be found. Defaulted to export symbols for ZSDDMUI.DLL - .*** WARNING: Unable to verify checksum for ZSR.DLL *** ERROR: Symbol file could not be found. Defaulted to export symbols for ZSR.DLL - .*** ERROR: Symbol file could not be found. Defaulted to export symbols for ZIMFDRV.DLL - .*** ERROR: Symbol file could not be found. Defaulted to export symbols for ZIMF.DLL - .*** WARNING: Unable to verify checksum for System.Data.SqlXml.ni.dll .*** WARNING: Unable to verify checksum for System.Numerics.ni.dll .*** ERROR: Symbol file could not be found. Defaulted to export symbols for SCHook.dll - .*** WARNING: Unable to verify checksum for Accessibility.ni.dll Loading unloaded module list ...................................................... ************* Symbol Loading Error Summary ************** Module name Error EMSClientApp No data is available : srv*c:\symbols*http://msdl.microsoft.com/download/symbols safemon The system cannot find the file specified : srv*c:\symbols*http://msdl.microsoft.com/download/symbols slc The system cannot find the file specified : srv*c:\symbols*http://msdl.microsoft.com/download/symbols ZSDNT5UI No data is available : srv*c:\symbols*http://msdl.microsoft.com/download/symbols ZSDDM The system cannot find the file specified : srv*c:\symbols*http://msdl.microsoft.com/download/symbols ZSPOOL No data is available : srv*c:\symbols*http://msdl.microsoft.com/download/symbols ZGDI No data is available : srv*c:\symbols*http://msdl.microsoft.com/download/symbols ZTAG No data is available : srv*c:\symbols*http://msdl.microsoft.com/download/symbols ZSDDMUI No data is available : srv*c:\symbols*http://msdl.microsoft.com/download/symbols ZSR No data is available : srv*c:\symbols*http://msdl.microsoft.com/download/symbols ZIMFDRV No data is available : srv*c:\symbols*http://msdl.microsoft.com/download/symbols ZIMF No data is available : srv*c:\symbols*http://msdl.microsoft.com/download/symbols SCHook No data is available : srv*c:\symbols*http://msdl.microsoft.com/download/symbols You can troubleshoot most symbol related issues by turning on symbol loading diagnostics (!sym noisy) and repeating the command that caused symbols to be loaded. You should also verify that your symbol search path (.sympath) is correct. |
#关键的来了,下面这个命令可以让我们的Windbg加载正确的.Net Framework运行托管代码的引擎.
0:000> .cordll -u -ve -lp C:\Framework\v4.0.30319 Automatically loaded SOS Extension CLRDLL: Loaded DLL C:\Framework\v4.0.30319\mscordacwks.dll CLR DLL status: Loaded DLL C:\Framework\v4.0.30319\mscordacwks.dll |
#虽然提示自动加载了SOS Extension,还是自己在手工加载一遍。
0:000> .load C:\Framework\v4.0.30319\SOS.dll |
#试试看成果
0:000> !clrstack OS Thread Id: 0x1c994 (0) Child SP IP Call Site 0017db60 774c70b4 [HelperMethodFrame_1OBJ: 0017db60] System.Threading.WaitHandle.WaitOneNative(System.Runtime.InteropServices.SafeHandle, UInt32, Boolean, Boolean) 0017dc08 6370b5ef System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle, Int64, Boolean, Boolean) 0017dc24 6370b5ad System.Threading.WaitHandle.WaitOne(Int32, Boolean) 0017dc3c 648c67c7 System.Net.LazyAsyncResult.WaitForCompletion(Boolean) 0017dc70 648ee9c4 System.Net.Connection.SubmitRequest(System.Net.HttpWebRequest, Boolean) 0017dcbc 648ee13a System.Net.ServicePoint.SubmitRequest(System.Net.HttpWebRequest, System.String) 0017dcfc 648eda65 System.Net.HttpWebRequest.SubmitRequest(System.Net.ServicePoint) 0017dd28 648f6011 System.Net.HttpWebRequest.GetRequestStream(System.Net.TransportContext ByRef) 0017dd60 648f5dae System.Net.HttpWebRequest.GetRequestStream() 0017dd68 07a4895b System.ServiceModel.Channels.HttpOutput+WebRequestHttpOutput.GetOutputStream() 0017dd9c 07a43d9a System.ServiceModel.Channels.HttpOutput.Send(System.TimeSpan) 0017ddcc 07a423db System.ServiceModel.Channels.HttpChannelFactory+HttpRequestChannel+HttpChannelRequest.SendRequest(System.ServiceModel.Channels.Message, System.TimeSpan) 0017de4c 07a418cc System.ServiceModel.Channels.RequestChannel.Request(System.ServiceModel.Channels.Message, System.TimeSpan) 0017ded0 07a417de System.ServiceModel.Dispatcher.RequestChannelBinder.Request(System.ServiceModel.Channels.Message, System.TimeSpan) 0017dee4 06fac120 System.ServiceModel.Channels.ServiceChannel.Call(System.String, Boolean, System.ServiceModel.Dispatcher.ProxyOperationRuntime, System.Object[], System.Object[], System.TimeSpan) 0017e034 06fabe04 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(System.Runtime.Remoting.Messaging.IMethodCallMessage, System.ServiceModel.Dispatcher.ProxyOperationRuntime) 0017e05c 06fab36a System.ServiceModel.Channels.ServiceChannelProxy.Invoke(System.Runtime.Remoting.Messaging.IMessage) 0017e0a0 636ca25e System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(System.Runtime.Remoting.Proxies.MessageData ByRef, Int32) 0017e330 6c6e2356 [TPMethodFrame: 0017e330] MyApplication.Contracts.IProcedureProvider_Service.SetItemData(System.String, System.String) ...... 0017f1b8 62f0f3d0 System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationContext) 0017f1c4 6de7c53c Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() 0017f1f0 6de7c3e8 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() 0017f21c 6de7cef9 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(System.String[]) 0017f268 00640117 MyApplication.ClientApp.frmMain.Main(System.String[]) 0017f4cc 6c6e21db [GCFrame: 0017f4cc] |
#熟悉的味道又回来了
更多参考
1. https://blogs.msdn.microsoft.com/dougste/2009/02/18/failed-to-load-data-access-dll-0x80004005-or-what-is-mscordacwks-dll/