Dot-Net

WinDbg中出現“SOS的版本與你正在調試的CLR版本不匹配”怎麼辦?

  • September 15, 2011

我的一些應用程序有問題。它是在 Windows 2003 Server (x86) 的 IIS6 下執行的基於 wcf 的應用程序:

在事件日誌中,我從“W3SVC-WP”源 (EventID=2262) 收到這樣的錯誤:

ISAPI 'C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll' reported itself as unhealthy for the following reason: 'Deadlock detected'.

我試圖弄清楚發生了什麼。我已經為孤兒工作程序設置了創建轉儲,如本KB中所述。當發生死鎖時,會創建一個小型轉儲。

然後我用這個小型轉儲來嘗試了解發生了什麼。這是我卡住了。

我執行 WinDbg x86,打開我的轉儲,然後:

0:037> .loadby sos clr
0:037> .sympath SRV*c:\temp\symbols*http://msdl.microsoft.com/download/symbols
Symbol search path is: SRV*c:\temp\symbols*http://msdl.microsoft.com/download/symbols
Expanded Symbol search path is: srv*c:\temp\symbols*http://msdl.microsoft.com/download/symbols
0:037> !clrstack
The version of SOS does not match the version of CLR you are debugging.  Please load the matching version of SOS for the version of CLR you are debugging.
CLR Version: 4.0.30319.1
SOS Version: 4.0.30319.235
CLRDLL: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscordacwks.dll:4.0.30319.235 f:8 doesn't match desired version 4.0.30319.01 f:8
CLRDLL: Loaded DLL c:\temp\symbols\mscordacwks_x86_x86_4.0.30319.01.dll\4BA1D9EF66f000\mscordacwks_x86_x86_4.0.30319.01.dll
OS Thread Id: 0x690 (37)
Unable to walk the managed stack. The current thread is likely not a managed thread.
You can run !threads to get a list of managed threads in the process

這個錯誤怎麼辦- “SOS 的版本與您正在調試的 CLR 的版本不匹配”?

我在 VS2010 中打開 minidump 時遇到了同樣的錯誤(“SOS 的版本與您正在調試的 CLR 的版本不匹配”)。

我讀過這篇文章 - <http://tech-thinker.com/Forums/tabid/62/forumid/12/postid/471/scope/posts/Default.aspx>,並嘗試安裝KB2518870。它沒有幫助。

WinDbg 將無法使用調試適配器 mscordacwks.dll,除非它與原始機器的版本相同。您可以通過將此 DLL 從生成轉儲的目標電腦複製到您的 Debugging Tools for Windows 目錄來解決此錯誤。

我們使用 WinDbg 調試 .NET 2.0 應用程序。關於 mscordacwks_x86_x86_2.0.50727.3615.dll,我們會不斷收到同樣的錯誤。我必須將此文件從伺服器複製到我的客戶端並將其放在 C:\Program Files\Debugging Tools for Windows (x86)\ 文件夾中。在那之後,WinDbg 不再抱怨了。

如果所有其他方法都失敗了,您可以嘗試在從中檢索故障轉儲的同一台伺服器上使用 WinDbg 進行調試。

這對我有用:

下載以下 DLL:

  • clr.dll
  • mscordacwks.dll
  • SOS.dll

從生成轉儲的機器上的這個文件夾中:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319

執行以下命令。SOS.DLL 的路徑應該不帶引號,未轉義的路徑分隔符:

.load下載的 SOS.DLL 的路徑

我認為這個工作需要一個新的 WinDbg 會話。

引用自:https://stackoverflow.com/questions/7430769