MOSS 2007 & Windows SharePoint Services Web Application service stating Error Starting.

Hello

Probably some of you have faced this issue in any of yor WFEs. It turns out that starting Windows SharePoint Services Web Application service, it stucks with the status: Error Starting.

One of the potential root cause of this issue is that a pending web.config modification hasn't been accomplished after deploying a custom WSP file

In order to identify if you are suffering this issue you should execute the following script:

///  This source code is freeware and is provided on an "as is" basis without warranties of any kind, whether express or implied, including without limitation warranties that the code is free of defect, fit for a particular purpose or non-infringing.  The entire risk as to
the quality and performance of the code is with the end user. MICROSOFT DO NOT SUPPORT THIS CODE. 

Set-ExecutionPolicy Unrestricted -force
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") | Out-Null
$webApplications = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.WebApplications | % { $_ }

foreach($weba in $webApplications)
{
        $webApp = $weba
        $webApp.WebConfigModifications
        $webApp
   

If after executing you have results, you should inspect what custom dlls is the culprit and then fix it.Furthermore in order to get the service back to the previous status before the deployment you should execute the following script:

///  This source code is freeware and is provided on an "as is" basis without warranties of any kind, whether express or implied, including without limitation warranties that the code is free of defect, fit for a particular purpose or non-infringing.  The entire risk as to
the quality and performance of the code is with the end user. MICROSOFT DO NOT SUPPORT THIS CODE. 

Set-ExecutionPolicy Unrestricted -force
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") | Out-Null
$webApplications = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.WebApplications | % { $_ }

foreach($weba in $webApplications)
{
        $webApp = $weba
        $webApp.WebConfigModifications.Clear()
        $webApp.Update()
   
}

THX

Kind Regards.

 Héctor Calvarro Martín. SharePoint Dev/Core. Microsoft Support Escalation Engineer for EMEA