共用方式為


在安裝 .NET 安全性修補程式以解決 CVE-2018-8421 後,SharePoint 編目程式可能會失敗

適用于:yes-img-132013 yes-img-16 2016yes-img-192019 yes-img-se訂閱版本 no-img-sopMicrosoft 365 中的 SharePoint

徵狀:

套用 2018 年 9 月 .NET 4.6 或更新版本更新之後,編目將會失敗,而且您會看到類似下列的專案:

<date> <time> mssdmn.exe (0x2730) 0x00D8 SharePoint Foundation   Database     fa45   High      System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception. ---> System.IO.FileNotFoundException: C:\Program Files\Microsoft Office Servers\16.0\bin\mssdmn.exe     at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)     at System.Configuration.ClientConfigPaths.SetNamesAndVersion(String applicationFilename, Assembly exeAssembly, Boolean isHttp)     at 
System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)     at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)     at System.Configuration.ClientConfigurationHost.RequireCompleteInit(IInternalConfigRecord 
record)     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)     at System.Configuration.ConfigurationManager.GetSection(String sectionName)     at System.Data.SqlClient.SqlConnection..cctor()     --- End of inner exception stack trace ---     at 
System.Data.SqlClient.SqlConnection..ctor(String connectionString)     at Microsoft.SharePoint.Utilities.SqlSession.OpenConnection()     at Microsoft.SharePoint.Administration.SPConfigurationDatabase.get_Local()     at Microsoft.SharePoint.Administration.SPFarm.FindLocal(SPFarm& farm, 
Boolean& isJoined)
<date> <time> mssdmn.exe (0x2730) 0x12E0 SharePoint Foundation   Topology     88bl   Monitorable  An exception occurred while trying to acquire the local farm: System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception. ---> System.IO.FileNotFoundException: C:\Program Files\Microsoft Office Servers\16.0\bin\mssdmn.exe     at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)     at System.Configuration.ClientConfigPaths.SetNamesAndVersion(String applicationFilename, Assembly exeAssembly, 
Boolean isHttp)     at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)     at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)     at 
System.Configuration.ClientConfigurationHost.RequireCompleteInit(IInternalConfigRecord record)     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)     at System.Configuration.ConfigurationManager.GetSection(String sectionName)     at System.Data.SqlClient.SqlConnection..cctor()     --- End of inner exception stack trace ---     
at System.Data.SqlClient.SqlConnection..ctor(String connectionString)     at Microsoft.SharePoint.Utilities.SqlSession.OpenConnection()     at Microsoft.SharePoint.Administration.SPConfigurationDatabase.get_Local()     at 
Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command, CommandBehavior behavior, SqlQueryData monitoringData, Boolean retryForDeadLock)     at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command, Boolean retryForDeadLock)     at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command)     at Microsoft.SharePoint.Upgrade.SPDatabaseSequence.GetVersion(SPDatabase database, Guid id, Version defaultVersion, SqlSession session, SPDatabaseSequence sequence)     at Microsoft.SharePoint.Upgrade.SPDatabaseSequence.get_SchemaVersion()     at Microsoft.SharePoint.Upgrade.SPSequence.get_IsBackwardsCompatible()     at Microsoft.SharePoint.Upgrade.SPUpgradeSession.IsBackwardsCompatible(Object o, Boolean bRecurse)

原因:

未定義 'SqlColumnEncryptionEnclaveProviders' 的組態區段,但 .NET Sql Client 需要它。

解決方案 1:

如果mssdmn.exe的設定檔尚未存在,請建立 (預設不會) 。 請確定組態檔具有下列內容:

mssdmn.exe.config的內容:

   <?xml version="1.0" encoding="UTF-8"?>
   <configuration>
       <configSections>
         <section name="SqlColumnEncryptionEnclaveProviders" 
             type="System.Data.SqlClient.SqlColumnEncryptionEnclaveProviderConfigurationSection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
   </configSections>
</configuration>

檔案通常應該位於此處:

  • SharePoint 2013: C:\Program Files\Microsoft Office Servers\15.0\bin\mssdmn.exe.config

  • SP 2016 和 SP 2019: C:\Program Files\Microsoft Office Servers\16.0\bin\mssdmn.exe.config

解決方案 2:

解決方案 1 可能會修正搜尋問題,但您仍可能會看到其他元件的問題。 如果您仍然看到其他元件的問題,您可以修改machine.config以包含變更。

下列腳本會自動進行變更。 您必須在發生問題的所有伺服器上執行此動作。

<#
Copyright (c) Microsoft Corporation. All rights reserved.
 
MIT License
 
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the ""Software""), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
 
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
 
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

#>

function Add-SQLEntry([string]$path)
{
    # Load machine.config file
    Write-Host "*** Config file: $path ***"
    $config = [xml](Get-Content $path -ErrorAction Stop)
 
    # Confirm whether the entry is already there
    $node = (Select-Xml -xml $config -xpath '//configuration/configSections/section[@name="SqlColumnEncryptionEnclaveProviders"]');
 
    if($node -ne $null)
    {
        Write-Host "1. Entry was already present";
        Write-Host "2. No change necessary"
        return $false
    }
    Write-Host "1. Entry for SqlColumnEncryptionEnclaveProviders is missing";
 
    $newNode = $config.CreateElement('section');
    $newNode.SetAttribute('name','SqlColumnEncryptionEnclaveProviders');
    $newNode.SetAttribute('type','System.Data.SqlClient.SqlColumnEncryptionEnclaveProviderConfigurationSection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089');
    
    $node = $config.SelectSingleNode('//configuration/configSections');
    $node.AppendChild($newNode);
 
    Write-Host "2. Adding entry"
 
    Write-Host "3. Backing up machine.config"
    # Make a backup of machine.config
    $addDate = (Get-Date).ToString('yyyyMMddHHmmssfff')
    Rename-Item -Path $path -NewName "$path.$addDate" -ErrorAction Stop
 
    Write-Host "4. Saving changes";
    $config.Save($path);
 
    Write-Host "5. Changes saved successfully"
    Write-Host ""
    & notepad $path
    return $true
}
 
$confPath32 = "$($env:windir)\Microsoft.NET\Framework\v4.0.30319\config\machine.config";
$confPath64 = "$($env:windir)\Microsoft.NET\Framework64\v4.0.30319\config\machine.config";
 
$addDate = (Get-Date).ToString('yyyyMMddHHmmssfff')
 
$success = Add-SQLEntry $confPath64
$success = Add-SQLEntry $confPath32

詳細資訊:

August-September 2018 .NET Framework 更新之後,.NET 4.6 和更新版本上的 SqlConnection 具現化例外狀況