Missing server side dependencies in SharePoint 2013

本文主要讨论了SharePoint 2013健康分析器中出现的[MissingWebPart]、[MissingSetupFile]和[MissingFeature]问题。这些问题分别涉及未安装的Web部件、缺失的设置文件和数据库中引用的缺失特性。为了解决这些问题,文章提供了如何定位并解决缺失特性、Web部件和文件的详细步骤,包括使用PowerShell脚本进行强制停用和删除操作,并给出了相关的解决方案链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The follow issues in Health Analyzer:

[MissingWebPart]

WebPart class [40209021-7bb0-e465-2576-abddac43061b] (class [CommunityForumTopics.WebParts.ForumTopicsWebPart.ForumTopicsWebPart] from assembly [CommunityForumTopics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4e4625abaca6859d]) is referenced [73] times in the database [WSS_Content], but is not installed on the current farm. Please install any feature/solution which contains this web part. One or more web parts are referenced in the database [WSS_Content], but are not installed on the current farm. Please install any feature or solution which contains these web parts.

[MissingSetupFile]

File [Features\image\GoToTop_normal_icon.png] is referenced [1] times in the database [WSS_Content], but is not installed on the current farm. Please install any feature/solution which contains this file. One or more setup files are referenced in the database [WSS_Content], but are not installed on the current farm. Please install any feature or solution which contains these files.

[MissingFeature]

Database [WSS_Content] has reference(s) to a missing feature: Id = [8096285f-1463-42c7-82b7-f745e5bacf29], Name = [My Feature], Description = [], Install Location = [Test-MyFeature]. The feature with Id 8096285f-1463-42c7-82b7-f745e5bacf29 is referenced in the database [WSS_Content], but is not installed on the current farm. The missing feature may cause upgrade to fail. Please install any solution which contains the feature and restart upgrade if necessary.

How to fix it?

[MissingFeature]

Note: This message reports a content database name and feature ID ,but not the sites or site collections where the feature exists. In addition to this, even if you did know where the feature was activated, it will not appear anywhere in the UI for you to deactivate because the solution has been removed from the farm.

The following PowerShell script will interrogate a specified content database and feature ID and do two things:

  1. Produce a report in the PowerShell console showing which sites or site collections contain the offending feature.
  2. Forcibly deactivate the feature from the applicable sites or site collections.
function Remove-SPFeatureFromContentDB($ContentDb, $FeatureId, [switch]$ReportOnly)
{
    $db = Get-SPDatabase | where { $_.Name -eq $ContentDb }
    [bool]$report = $false
    if ($ReportOnly) { $report = $true }
    
    $db.Sites | ForEach-Object {
        
        Remove-SPFeature -obj $_ -objName "site collection" -featId $FeatureId -report $report
                
        $_ | Get-SPWeb -Limit all | ForEach-Object {
            
            Remove-SPFeature -obj $_ -objName "site" -featId $FeatureId -report $report
        }
    }
}

function Remove-SPFeature($obj, $objName, $featId, [bool]$report)
{
    $feature = $obj.Features[$featId]
    
    if ($feature -ne $null) {
        if ($report) {
            write-host "Feature found in" $objName ":" $obj.Url -foregroundcolor Red
        }
        else
        {
            try {
                $obj.Features.Remove($feature.DefinitionId, $true)
                write-host "Feature successfully removed from" $objName ":" $obj.Url -foregroundcolor Red
            }
            catch {
                write-host "There has been an error trying to remove the feature:" $_
            }
        }
    }
    else {
        #write-host "Feature ID specified does not exist in" $objName ":" $obj.Url
    }

}


 # it will find the feature 

 Remove-SPFeatureFromContentDB -ContentDB "WSS_Content" -FeatureId "<span style="color:#3366ff;">8096285f-1463-42c7-82b7-f745e5bacf29</span>" -ReportOnly

 # it will remove the feature directly


 Remove-SPFeatureFromContentDB -ContentDB "WSS_Content" -FeatureId "<span style="color:#3366ff;">8096285f-1463-42c7-82b7-f745e5bacf29</span>" 
 


[MissingWebPart]

Note: These events are logged because the migrated SharePoint  Sites contains some references to custom WebPart files and the linked feature/solution are not installed in the Farm

To safely remove the webparts and references, we need to be able to identify their specific location on the Farm

# the name of the Db server
$DBserver = "tristan-db"
#<strong>[path\missingwebparts.txt]</strong> is a input file you need to create based on the <strong>[MissingWebPart]</strong> errors that you get on the SharePoint Health Analyzer
$path = "C:\Users\tristan-desktop\Script\MissingHealth.txt" 
#Set Variables
$input = @(Get-Content $path)
 

#Declare Log File
Function StartTracing
{
    $LogTime = Get-Date -Format yyyy-MM-dd_h-mm
    $script:LogFile = "MissingWebPartOutput-$LogTime.csv"
    Start-Transcript -Path $LogFile -Force
}
 
#Declare SQL Query function
function Run-SQLQuery ($SqlServer, $SqlDatabase, $SqlQuery)
{
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server =" + $SqlServer + "; Database =" + $SqlDatabase + "; Integrated Security = True"
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = $SqlQuery
$SqlCmd.Connection = $SqlConnection
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$DataSet = New-Object System.Data.DataSet
$SqlAdapter.Fill($DataSet)
$SqlConnection.Close()
$DataSet.Tables[0]
}
 
 
function GetWebPartDetails ($wpid, $DBname)
    {
    #Define SQL Query and set in Variable
    $Query =  "SELECT * from AllDocs inner join AllWebParts on AllDocs.Id = AllWebParts.tp_PageUrlID where AllWebParts.tp_WebPartTypeID = '"+$wpid+"'"
 
    #Runing SQL Query to get information about Assembly (looking in EventReceiver Table) and store it in a Table
    $QueryReturn = @(Run-SQLQuery -SqlServer $DBserver -SqlDatabase $DBname -SqlQuery $Query | select Id, SiteId, DirName, LeafName, WebId, ListId, tp_ZoneID, tp_DisplayName)
 
    #Actions for each element in the table returned
        foreach ($event in $QueryReturn)
        {
            if ($event.id -ne $null)
                {
                #Get Site URL
                $site = Get-SPSite -Limit all | where {$_.Id -eq $event.SiteId}
    
write-host "==================================================================="
                write-host $site.Url -nonewline -foregroundcolor green 
                write-host "/" $event.DirName -nonewline -foregroundcolor green 
                write-host "/"$event.LeafName  -foregroundcolor green 
                }
         }
    }
 
 Start Logging
 StartTracing
 
#Log the CVS Column Title Line
 write-host "WebPartID;PageUrl;MaintenanceUrl;WpZoneID" -foregroundcolor Red
 
 foreach ($event in $input)
    {
     $wpid = $event.split(";")[0]
     $DBname = $event.split(";")[1]
     GetWebPartDetails $wpid $dbname
    }
    
 Stop Logging
 Stop-Transcript

run the cmd:

1. it will found ou all the relevant pags implemented the webpart

2. then you need to delete the webpart in the exactly page one by one by manual

3. clear the history version of the page

4. finally, remember to clear the recycle bin

you can run the cmd again to check the result, it will not find the same issues.

[MissingSetFile]

Note: These events are logged because the migrated SharePoint 2013 Sites contains some references to custom Feature files and the linked feature are not installed in the Farm.

The easy solution is obviously to install the features related to those files, but if you are in the same situation as me, you don't really need the features anymore and you just want the database to be clean and get rid of these events.

 DBserver = "tristan-db"
 $path = "C:\Users\Script\MissingHealth_Set.txt"

  
 #Set Variables  
 $input = @(Get-Content $path)  
 #Addin SharePoint2010 PowerShell Snapin  
 Add-PSSnapin -Name Microsoft.SharePoint.PowerShell  
 #Declare Log File  
 Function StartTracing  
 {  
   $LogTime = Get-Date -Format yyyy-MM-dd_h-mm  
   $script:LogFile = "MissingSetupFileOutput-$LogTime.txt"  
   Start-Transcript -Path $LogFile -Force  
 }  
 #Declare SQL Query function  
 function Run-SQLQuery ($SqlServer, $SqlDatabase, $SqlQuery)  
 {  
   $SqlConnection = New-Object System.Data.SqlClient.SqlConnection  
   $SqlConnection.ConnectionString = "Server =" + $SqlServer + "; Database =" + $SqlDatabase + "; Integrated Security = True"  
   $SqlCmd = New-Object System.Data.SqlClient.SqlCommand  
   $SqlCmd.CommandText = $SqlQuery  
   $SqlCmd.Connection = $SqlConnection  
   $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter  
   $SqlAdapter.SelectCommand = $SqlCmd  
   $DataSet = New-Object System.Data.DataSet  
   $SqlAdapter.Fill($DataSet)  
   $SqlConnection.Close()  
   $DataSet.Tables[0]  
 }  
 #Declare the GetFileUrl function  
 function GetFileUrl ($filepath, $DBname)  
 {  
     #Define SQL Query and set in Variable  
     $Query = "SELECT * from AllDocs where SetupPath = '"+$filepath+"'"  
     #Runing SQL Query to get information about the MissingFiles and store it in a Table  
     $QueryReturn = @(Run-SQLQuery -SqlServer $DBserver -SqlDatabase $DBname -SqlQuery $Query | select Id, SiteId, DirName, LeafName, WebId, ListId)  
     foreach ($event in $QueryReturn)  
       {  
         if ($event.id -ne $null)  
         {  
         $site = Get-SPSite -Limit all | where { $_.Id -eq $event.SiteId }  
         #get the URL of the Web:  
         $web = $site | Get-SPWeb -Limit all | where { $_.Id -eq $event.WebId }  
         #Write the SPWeb URL to host  
         Write-Host $filepath -nonewline -foregroundcolor yellow  
         Write-Host ";" -nonewline  
         write-host $web.Url -NoNewline -foregroundcolor green  
         #get the URL of the actual file:  
         $file = $web.GetFile([Guid]$event.Id)  
         #Write the relative URL to host  
         write-host "/" -nonewline -foregroundcolor green  
         write-host $file.Url -foregroundcolor green 
         #$file.delete()  # you can delete the file with this code
         }  
       }  
 }  
 #Start Logging  
 StartTracing  
 #Log the CVS Column Title Line  
 write-host "MissingSetupFile;Url" -foregroundcolor Red  
 foreach ($event in $input)  
   {  
   $filepath = $event.split(";")[0]  
   $DBname = $event.split(";")[1]  
   #call Function  
   GetFileUrl $filepath $dbname  
   }  
 #Stop Logging  
 Stop-Transcript  

Note: If you want to get rid of all files unused, update the above script by adding the line $file.delete() after the line write-host $file.Url -foregroundcolor green  in the IF statement 
(to be used at your own risk - I would strongly recommend to first analyse the report generated before updating the script with the delete option, to avoid removing important files.)


More in detail : http://etienne-sharepoint.blogspot.jp/2011/10/solving-missingsetupfile-errors-from.html, http://get-spscripts.com/2011/06/removing-features-from-content-database.html









<think>嗯,用户遇到了部署依赖的问题,显示多个Deployment都缺少WebServer依赖,状态是ERROR或NOT FOUND。首先,我需要确定这些错误的原因。可能的情况包括WebServer服务未正确安装、配置错误,或者启动失败。 用户可能是在使用JBoss或类似的Java应用服务器,比如WildFly。WebServer组件(如Tomcat或Undertow)可能未能启动,导致依赖它的其他部署无法进行。需要检查服务器的日志文件,特别是启动日志,看看有没有相关的错误信息,比如端口冲突、权限问题或者配置错误。 另外,检查WebServer的配置文件是否正确,比如端口设置是否被占用,SSL配置是否有误。如果WebServer本身处于ERROR状态,可能需要重新安装或修复其配置。对于依赖状态为Create的情况,可能需要在部署其他组件之前先确保WebServer已经成功创建。 用户可能不太清楚如何查看日志或配置文件的位置,需要给出具体的路径建议,例如在JBoss中日志通常位于standalone/log目录下。此外,可能需要指导用户如何重启服务,或者如何重新部署WebServer组件。 如果WebServer确实不存在,可能需要确认安装步骤是否正确,是否有遗漏的安装模块。有时候依赖管理工具的问题也会导致组件未正确安装,这时候重新安装或更新软件可能有效。 总结下来,解决步骤应该是:1. 检查WebServer的状态和日志;2. 解决WebServer自身的错误;3. 确保依赖顺序正确,可能需要重新部署或调整配置;4. 验证修复后的部署状态。</think>这个错误信息表明多个部署组件存在依赖关系缺失的问题,主要涉及"WebServer"服务的状态异常。以下是分步排查和解决方案: --- ### **第一步:分析错误类型** 1. **ERROR状态** - 前4个部署错误显示`WebServer`处于**ERROR**状态,说明核心Web服务未能正常启动 - 最后2个部署显示`WebServer`**NOT FOUND**,表明依赖的Web服务根本不存在 2. **依赖关系逻辑** - 所有部署都需要`WebServer`先达到指定状态(Installed/Create),但实际条件未满足 --- ### **第二步:定位WebServer问题** #### **可能原因** 1. **端口冲突** - WebServer默认端口(80/8080/443)被其他进程占用 - 检查命令(Linux): ```bash netstat -tuln | grep -E ':80|:8080|:443' ``` 2. **配置错误** - 检查`standalone.xml`或`domain.xml`中的Web子系统配置: ```xml <subsystem xmlns="urn:jboss:domain:undertow:10.0"> <http-listener name="default" socket-binding="http" redirect-socket="https"/> ... </subsystem> ``` 3. **证书/SSL问题** - 如果启用了HTTPS,检查证书路径和权限配置 4. **依赖服务未启动** - 确保JDBC驱动、连接池等基础服务已正确加载 --- ### **第三步:解决方案** #### **1. 检查服务日志** - 查看服务器日志定位具体错误(路径示例): ```bash tail -f $JBOSS_HOME/standalone/log/server.log ``` - 搜索关键词:`WebServer`、`undertow`、`HTTP`、`failed to start` #### **2. 解决端口冲突** - 修改WebServer端口(示例修改为8081): ```xml <socket-binding-group name="standard-sockets" ...> <socket-binding name="http" port="${jboss.http.port:8081}"/> </socket-binding-group> ``` #### **3. 重新部署WebServer** - 如果服务未正确初始化,尝试手动触发: ```bash # JBoss/WildFly CLI /subsystem=undertow:restart ``` #### **4. 验证依赖加载顺序** - 确保部署描述符(如`jboss-web.xml`)中定义的依赖优先级: ```xml <jboss-web> <depends>jboss.web:service=WebServer</depends> </jboss-web> ``` --- ### **第四步:验证修复** 1. 重启应用服务器 2. 检查WebServer状态: ```bash curl -I http://localhost:8080 ``` 3. 观察部署日志中是否仍报告依赖缺失 --- ### **补充说明** - 若使用**ModCluster**(集群模块),需额外检查`mod_cluster`配置与后端服务器的通信 - 对于`NOT FOUND`错误,可能需要重新安装Web子系统: ```bash module add --name=org.wildfly.extension.undertow --resources=/path/to/undertow-module ``` 建议通过逐步排除法定位具体原因,优先解决`WebServer`自身的错误状态,再处理依赖关系问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值