NullReferenceException 与产品配置向导

症状

可能会遇到以下问题:

  • 使用产品配置SharePoint向导时,它在任务 8 期间失败,并返回以下错误消息:

    Failed to install the application content files.  
    This is a critical task. You have to fix the failures before you can continue.   
    An exception of type System.NullReferenceException was thrown. Additional exception information: Object reference not set to an instance of an object.   
    To diagnose the problem, review the application event log and the configuration log file located at:C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\        
    

    PSCDiagnostics 记录在 PSCDiagnostics 日志文件:

    Exception: System.NullReferenceException: Object reference not set to an instance of an object.   
    at Microsoft.SharePoint.Administration.SPAspConfigurationFile.ApplyActionToXmlDocument(XmlDocument xdAction, XmlDocument xd, String sourceFileName, SupportedXmlDocutmentActions supportedActions)   
    at Microsoft.SharePoint.Administration.SPAspConfigurationFile.MergeWebConfig(XmlDocument xdWebConfig, String fileMask)   
    at Microsoft.SharePoint.Administration.SPWebService.ApplyApplicationContentToLocalServer()   
    at Microsoft.SharePoint.PostSetupConfiguration.ApplicationContentTask.Run()   
    at Microsoft.SharePoint.PostSetupConfiguration.TaskThread.ExecuteTask()
    
  • 使用 SPWebService.ApplyApplicationContentToLocalServer 方法时,会收到以下错误消息:

    Message Title     
    Exception calling "ApplyApplicationContentToLocalServer" with "0" argument(s):   
    "Object reference not set to an instance of an object."   
    At line:1 char:1   
    + $webservice.ApplyApplicationContentToLocalServer()  
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceException           
    

原因

出现问题的原因是,Web 应用程序的 web.config 文件中存在SharePoint注释。

解决方案

若要解决此问题,请查找并删除所有 Web web.config文件的所有SharePoint注释。

更多信息

仍然需要帮助? 请转到 SharePoint 社区