﻿# 無法開始監視 'xx' 的變更，因為已經到達網路 BIOS 命令限制

在去年底的時候曾經在客戶的網站主機收到一個 **載入組態檔時發生錯誤: 無法開始監視 '\\\\10.0.1.1\\Shared\\8666-f79049226252' 的變更，因為已經到達網路 BIOS 命令限制** 的錯誤，當時並不知道是什麼問題，只知道重新啟動 IIS 或回收應用程式集區就會恢復正常，但最近已經瞭解了問題發生的主因。

當時的環境是兩台 Windows Server 2003 (x86) / IIS6 網站伺服器，兩台主機做負載平衡(Load Balance)，而網站有部分目錄是共用的，所以透過 UNC 路徑的方式將檔案放置在另一台 Windows Server 2003 (x86) 主機上，在平時都運作正常，但偶而會發生以下錯誤訊息：

> 載入組態檔時發生錯誤: 無法開始監視 '\\\\10.0.1.1\\Shared\\8666-f79049226252' 的變更，因為已經到達網路 BIOS 命令限制。如需此錯誤的詳細資訊，請參閱 Microsoft 知識庫文件 810886。不支援在 Windows XP 平台的 UNC 共用上裝載。 (\\\\10.0.1.1\\Shared\\8666-f79049226252\\web.config)

以下是當時從事件檢視器收到的錯誤訊息：

```
事件代碼: 3008 
事件訊息: 發生組態錯誤。 
事件時間: 12/22/2009 1:14:55 PM 
事件時間 (UTC): 12/22/2009 5:14:55 AM 
事件 ID: 96eedefb410b4161b05e2bdce7e9976e 
事件序列: 955 
事件項目: 1 
事件詳細資料代碼: 0 

應用程式資訊: 
應用程式定義域: /LM/W3SVC/1603528564/Root-1-129059311890503750 
信任層級: Full 
應用程式虛擬路徑: / 
應用程式路徑: C:\inetpub\wwwroot\ 
電腦名稱: WF-Web1

處理序資訊: 
處理序 ID: 2348 
處理序名稱: w3wp.exe 
帳戶名稱: NT AUTHORITY\NETWORK SERVICE 

例外狀況資訊: 
例外狀況型別: ConfigurationErrorsException 
例外狀況訊息: 載入組態檔時發生錯誤: 無法開始監視 '\\10.0.1.1\Shared\8666-f79049226252' 的變更，因為已經到達網路 BIOS 命令限制。如需此錯誤的詳細資訊，請參閱 Microsoft 知識庫文件 810886。不支援在 Windows XP 平台的 UNC 共用上裝載。 (\\10.39.1.44\Shared\8666-f79049226252\web.config) 

要求資訊: 
要求 URL: http://www.example.com/images/8666-f79049226252/IMG_0205.jpg 
要求路徑: /images/8666-f79049226252/IMG_0205.jpg 
使用者主機位址: 192.168.79.13 
使用者: 
已驗證: False 
驗證類型: 
執行緒帳戶名稱: NT AUTHORITY\NETWORK SERVICE 

執行緒資訊: 
執行緒 ID: 1 
執行緒帳戶名稱: NT AUTHORITY\NETWORK SERVICE 
正在模擬: False 
堆疊追蹤: at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Web.Configuration.RuntimeConfig.GetSectionObject(String sectionName)
at System.Web.Configuration.RuntimeConfig.GetSection(String sectionName, Type type, ResultsIndex index)
at System.Web.Configuration.RuntimeConfig.get_Identity()
at System.Web.HttpContext.get_ImpersonationToken()
at System.Web.ClientImpersonationContext.Start(HttpContext context, Boolean throwOnError)
at System.Web.HttpApplication.ThreadContext.SetImpersonationContext()
at System.Web.HttpApplication.ThreadContext.Enter(Boolean setImpersonationContext)
at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext)
at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)

自訂事件詳細資料: 

請在 http://go.microsoft.com/fwlink/events.asp 查看說明及支援中心，以取得其他資訊。
```

發生的主因在於 Web 伺服器透過 UNC 連接檔案伺服器(File Server) 時若連線數過大時，可能會導致 RPC 運作失敗因而無法透過 UNC 存取檔案，所以才會出現這樣的錯誤，那是因為在 x86 架構下的不分頁記憶體(non-paged pool memory)有限，在一台 x86 架構下的機器的上限為 256MB，所以 Windows 才會讓 UNC 連接時的同時連線數降低，才不會避免記憶體不足而導致系統不穩定的情況。

即便到了 Windows Server 2008 作業系統，如果你安裝 x86 架構的版本，依然會有可能發生這個錯誤，必須進一步處理。不過此問題在 x64 架構下不會發生，因為 x64 架構下的不分頁記憶體上限有 128GB 之多，所以很難發生類似的錯誤。*註: 目前最新版的 Windows Server 2008 R2 僅提供 x64 版本。*

解決方法就是調整 Client 端 ( IIS 網站伺服器 ) 與 Server 端 ( 檔案伺服器 ) 的系統機碼，兩端如果都是 x86 架構的作業系統，則兩邊的主機都需要進行設定。

**修改 Client 端電腦的機碼 ( 也就是使用檔案伺服器的電腦，也就是執行 IIS 主機 )**

建立 Client.reg 機碼檔，並輸入以下內容，並進行合併機碼的動作：

> Windows Registry Editor Version 5.00  
> \[HKEY\_LOCAL\_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\lanmanworkstation\\parameters\]  
> "MaxCmds"=dword:00000800

**修改 Server 端電腦的機碼 ( 也就提供 UNC 檔案服務的檔案伺服器 )**

建立 Server.reg 機碼檔，並輸入以下內容，並進行合併機碼的動作：

> Windows Registry Editor Version 5.00  
> \[HKEY\_LOCAL\_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\lanmanserver\\parameters\]  
> "MaxMpxCT"=dword:00000800  
> "MaxWorkItems"=dword:00002000

\---

若你想比較 x86 與 x64 下的記憶體架構，可以參考[這篇 KB 文章](https://web.archive.org/web/20090120182850/http://support.microsoft.com:80/kb/294418)。

**相關連結**

-   [IIS runs out of work items and causes RPC failures when connecting to a remote UNC path](https://web.archive.org/web/20101105152718/http://support.microsoft.com:80/kb/221790)

-   [MaxMpxCt and MaxCmds limits in Windows 2000](http://support.microsoft.com/?scid=kb;en-us;271148)
-   [Comparison of 32-bit and 64-bit memory architecture for 64-bit editions of Windows XP and Windows Server 2003](https://web.archive.org/web/20090120182850/http://support.microsoft.com:80/kb/294418)
-   Terminal Server Client Connections and Logon Limited by MaxWorkItem and MaxMpxCt Values

-   [Your ASP or ASP.NET application may restart or you may lose the session object when more SMB requests exist than the Web server can process](http://support.microsoft.com/?scid=kb;en-us;843584)
-   ["The network BIOS command limit has been reached" error message in Windows Server 2003, in Windows XP, and in Windows 2000 Server](http://support.microsoft.com/?scid=kb;en-us;810886)
-   [Security Guidance for IIS](http://technet.microsoft.com/en-us/library/dd450371\(WS.10\).aspx)
