Web.config 檔案在伺服器陣列中的所有機器上並不相同 (SharePoint Server)Web.config files are not identical on all machines in the farm (SharePoint Server)

摘要:了解如何解決 SharePoint Server 2016 和 SharePoint 2013 中的 SharePoint Health Analyzer 規則「Web.config 檔案在伺服器陣列中的所有機器上並不相同」。Summary: Learn how to resolve the SharePoint Health Analyzer rule "Web.config files are not identical on all machines in the farm", in SharePoint Server 2016 and SharePoint 2013.

規則名稱: 伺服器陣列中所有機器的 Web.config 檔案皆不相同。Rule Name: Web.config files are not identical on all machines in the farm.

摘要: 如果在伺服器陣列中有多部前端網頁伺服器,並且已手動變更 Web.config 檔案,將會發生前端網頁伺服器無法讀取伺服器陣列中其他伺服器儲存的工作階段狀態。Summary: If you have multiple front-end Web servers in the farm and have made manual changes to the Web.config files, you will experience a problem where a front-end Web server cannot read session state that was saved by another server in the farm.

原因:伺服器陣列中前端網頁伺服器上的 Web.config 檔案皆不相同。Cause: The Web.config files on the front-end Web servers in the farm are not identical.

解決方案:請確認伺服器陣列中所有前端網頁伺服器上的 Web.config 檔案皆相同。Resolution: Ensure that the Web.config files are identical on all front-end Web servers in the farm.

  1. 確認執行此程序的使用者帳戶為伺服器陣列管理員群組的成員。Verify that the user account that is performing this procedure is a member of the Farm Administrators group.

  2. 識別的伺服器發生此事件。在 SharePoint 管理中心網站的 [監視] 區段中按一下 [檢閱問題與方案,然後尋找失敗的伺服器] 欄中的 [伺服器名稱。如果在伺服器陣列中有多個失敗的伺服器,必須重複執行下列步驟在每部失敗的伺服器上。Identify the server on which this event occurs. On the SharePoint Central Administration website, in the Monitoring section, click Review problems and solutions, and then find the name of the server in the Failing Servers column. If there are multiple failing servers in a server farm, you must repeat the following steps on each failing server.

  3. 確認執行下列步驟的使用者帳戶是您在先前步驟中識別之本機電腦上系統管理員群組的成員。Verify that the user account that is performing the following steps is a member of the Administrators group on the local computer that you identified in the previous step.

  4. 登入發生此事件的伺服器。Log on to the server on which this event occurs.

  5. 一般而言,Web.config 檔案會儲存在 C:\inetpub\wwwroot\wss\VirtualDirectories\Port_Number。請注意 Web.config 檔案的修改日期。Typically the Web.config file is stored at C:\inetpub\wwwroot\wss\VirtualDirectories\Port_Number. Note the modified date of the Web.config file.

  6. 請在其他失敗的伺服器上重複上述步驟。Repeat the previous steps on other failing servers.

  7. 請比較這些 Web.config 檔案並決定正確的檔案。若要檢視 Web.config 檔案的內容,請執行下列動作:Compare these Web.config files and decide which one is correct. To view the content of the Web.config file, do the following:

  8. [伺服器管理員] 中 [工具] 和 [網際網路資訊服務 (IIS) 管理員]In Server Manager, click Tools, and then click Internet Information Services (IIS) Manager.

  9. 在網際網路資訊服務管理主控台中,在 [連線] 窗格中,展開樹狀檢視中的伺服器名稱、 依序展開 [網站] 和 [您要檢視的 Web.config 檔案中設定的網站。In the Internet Information Services management console, in the Connections pane, expand the tree view of the server name, expand Sites, and then click the site for which you want to view the settings of the Web.config file.

  10. 在網站首頁上,切換至 [功能] 檢視中,並連按兩下 [管理] 區段中的 [設定編輯器On the site Home page, switch to the Features View, and then in the Management section, double-click Configuration Editor.

  11. 在 [區段] 清單中選取一個區段以檢視 Web.config 檔案的設定。In the Section list, select a section to view the settings of the Web.config file.

  12. 在每個失敗伺服器上刪除不正確的 Web.config 檔案,然後複製並貼上正確的 Web.config 檔案。Delete the incorrect Web.config file on each failing server, and then copy and paste the correct Web.config file.

根據預設,[自動修復] 選項會啟用此規則。您可以執行下列動作還原此規則的預設值:By default, the Repair Automatically option is enabled for this rule. You can restore the default setting for this rule by doing the following:

還原預設設定Restore default setting

  1. 在管理中心按一下 [監視]。In Central Administration, click Monitoring.

  2. 按一下 [監視] 頁面的 [狀況分析器] 區段的 [檢閱規則定義]。On the Monitoring page, in the Health Analyzer section, click Review rule definitions.

  3. 在 [狀況分析規則定義-所有規則] 都頁面中類別: 設定] 區段中,按一下規則的名稱。On the Health Analyzer Rule Definitions - All Rules page, in the Category: Configuration section, click the name of the rule.

  4. 在 [狀況分析規則定義] 對話方塊中,按一下 [編輯項目In the Health Analyzer Rule Definitions dialog box, click Edit Item.

  5. 選取自動修復] 核取方塊,然後再按一下 [儲存Select the Repair Automatically check box, and then click Save.