Tuesday 14 May 2013

Deleting customised web applications in SharePoint 2010 – HTTP 404 Error


General Introduction
Deleting SharePoint 2010 applications is always an easy task. At least for the web applications with site collections having no major customisations and features activated on them, it is moderately easy to go to Central administration -> Manage Web Applications -> select the required Web application and click delete button from the ribbon. It immediately prompts to select the 2 major components to be deleted which are the content database and the IIS container sites. You can select either one of them or both and click OK to delete the required web applications. Alternatively, Windows PowerShell can be leveraged to remove the web application by using the Remove-SPWebapplication cmdlet with -DeleteIISSite and/or –RemoveContentDatabases option(s) as required.

Problem Description
However, if your farm is heavily customised with many farm level solutions used by various web applications, it is not easy to delete a web application. This is what I have learnt from my experience. When I tried to a web application which is heavily customised and is also extended to a different zone with a different type of authentication, the application is not getting deleted although I tried to delete the web application in various ways mentioned above. The error I was getting is a typical SharePoint error page with a correlation ID and a message “404: File not found”. At the first second, I thought “What! A 404 error?” Then I checked the IIS container sites which are removed from the server. But the web application continued to appear in the web application management page in the central administration.

Troubleshooting & Resolution
I tried to troubleshoot further to check if there was timer job still running or hung by any chance. I browsed to Timer job definitions in the Monitoring section of central administration. However, this page started to show the same error. It was at this point that I realised there was something else going on. Time for ULS logs!! I checked the correlation ID in the ULS log and found that there were few custom application DLLs missing in the registry. These DLLs were part of the solutions (wsps) that were deployed to the web application to be deleted. I had no idea why the DLLs got knocked out of registry since I was not removing the WSPs. The WSPs which were deployed only to the web application, that I was removing, changed their status to “Not Deployed” state but the DLLs were never knocked out. I could not find a clue for why they got knocked out. I had manually placed those missing DLLs listed in ULS logs back in the registry in all the servers of the farm and did an IISReset. Then the timer job definitions page started working. And, we were able to successfully delete the web application too. The manage web applications page did not display the web application this time.

Looking back into what has happened, when we have a farm with highly customised applications, I think it is always recommended to deploy the DLLs (WSPs) to the bin directory of the application’s virtual directory rather than the system’s assembly.

I hope this post helps in resolving this type of issues that you might be facing.

No comments: