Delete a Web application (SharePoint Foundation 2010)
Applies to: SharePoint Foundation 2010
This article describes how to delete a Web application. When you delete a Web application, you can optionally delete the content databases and the IIS Web sites. If you delete the content databases, all site content contained within them is deleted. If you delete the IIS Web sites, all IIS metabase entries that refer to the Web application are also deleted. If you only delete the Web application and not the content databases and the IIS Web sites, the content databases and IIS Web sites can be reused by another Web application.
Typically, you would delete a Web application for maintenance purposes or if you are rearchitecting the server farm.
If you are hosting content or applications other than SharePoint content on the IIS Web site that is hosting the Web application, you might want to consider not removing the IIS Web sites. Also, if you are performing maintenance work, you probably want to keep the IIS Web sites. However, if you are only hosting SharePoint content on the IIS Web site or if you plan to do a complete restructuring, then you would want to delete the IIS Web site.
If you want to delete the Web application temporarily, for example, to create the Web application under a different application pool, you might consider not removing the content databases. You can then recreate the Web application with the desired settings and reattach the existing content databases. If you delete the content databases, your content is gone forever unless you have a backup to restore the content databases.
Before you perform these procedures, confirm that:
You know the implications of deleting the IIS Web site and the content databases should you chose this option.
You have made a backup of the Web application that you plan to delete if, for some reason, you want to restore the deleted Web application. For more information, see Back up a Web application (SharePoint Foundation 2010).
If you have User Account Control (UAC) turned on in Windows, and you use Windows PowerShell to delete a Web application, you must right-click the SharePoint 2010 Management Shell and select Run as administrator.
You can delete a Web application by using the SharePoint Central Administration Web site or Windows PowerShell. You typically use Central Administration to delete a Web application in a single server with built-in database deployment. If you want to automate the task of deleting a Web application, which is common in enterprises, use Windows PowerShell.
To delete a Web application by using Central Administration
Verify that you have the following administrative credentials:
- To delete a Web application, you must be a member of the Farm Administrators SharePoint group and a member of the local Administrator group on the computer running Central Administration.
On the Central Administration Home page, in the Application Management section, click Manage web applications.
Select the Web application that you want to delete, and on the ribbon, click Delete and then Delete Web Application.
On the Delete Web Application page, in the Delete Options section, under Delete content databases select Yes if you want to delete the content databases associated with the Web application. Otherwise, select No to keep the content databases.
Under Delete IIS Web sites, select Yes to delete the Web application and the associated IIS Web site. Otherwise, select No to remove only the association of the IIS Web site with the Web application.
Important
If your IT environment requires the use of a database administrator (DBA) for database creation and management, you might need to contact your DBA to delete the content databases for the Web application. For information about deploying in an environment that uses DBA-created databases, see Deploy by using DBA-created databases (SharePoint Foundation 2010).
To delete a Web application by using Windows PowerShell
Verify that you meet the following minimum requirements: See Add-SPShellAdmin. You must also be a member of the local Administrators group on the computer running Central Administration. If you want to delete the content databases associated with this Web application, you also need to have the SharePoint_Shell_Access role within these content databases.
On the Start menu, click All Programs.
Click Microsoft SharePoint 2010 Products.
Click SharePoint 2010 Management Shell.
At the Windows PowerShell command prompt, type the following command:
Remove-SPWebApplication -identity http://sitename -Confirm
This command permanently removes the Web application at
http://sitename
. This command does not remove the content databases or the IIS Web site.
For more information, see Remove-SPWebApplication.
Note
We recommend that you use Windows PowerShell when performing command-line administrative tasks. The Stsadm command-line tool has been deprecated, but is included to support compatibility with previous product versions.