ASP.NET Web Deployment Overview
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
After you have created an ASP.NET Web application project or an ASP.NET Web site project in Visual Studio 2010, you typically deploy the project to a Web server running IIS where others can access your application or site. Several tasks must be accomplished before a Web application project or a Web site project can be made available to a larger audience on the Internet or on an internal company intranet.
You can deploy a Web site or Web application in several ways, though the technique for deploying a Web sites and a Web application are different.
To deploy a Web site:
you can copy the site files to a Web server using the Copy feature in Visual Studio.
use a file transfer protocol like FTP.
To deploy a Web application:
you use Visual Studio to either package the application and copy the package to a Web server or
use the Publish feature to deploy an application.
To deploy a Web application project or a Web site project to a third-party or hosted server, you must have the following:
An account on a third-party server or access to a Web server.
A URL or domain name where users will access your Web application project or Web site project.
A way to upload your application or site files to the server.
Administration rights to the server or a way, such as a control panel, to provide information to the server administrator.
A way to set IIS settings for the application or site.
A way to deploy a databases with a Web application.
Deploying a Web site project or Web application project to an internal company intranet follows similar requirements. In that case, you typically have a corporate network account for the company intranet, or work with a server administrator to copy the files to a particular location. Additional settings would be made by the administrator.
A hosting company provides space on their Web servers where you can upload a Web site or Web application and keep the data for your site. The Web server handles the Web requests that come to your site, and the hosting company manages tasks such as backing up the server, upgrading the server, and maintaining the .NET Framework and IIS software required to run a site.
Every hosting company is different, but they generally all offer a hosting package that provides disk space for your site and data storage, plus a bandwidth quota which determines how much data your site can send out every month. Some packages include access to Microsoft SQL Server or another database server. In other packages, you might pay extra for database storage.
In most cases you do not have administrator rights on the hosting company's servers. Therefore you are restricted in how you can move files or databases onto the hosting servers and how you provide settings, such as IIS settings. Many hosting companies provide custom control panels to accomplish this task.
Deploying an ASP.NET Web application can involve copying many files and an assortment of settings from a development computer to a testing, staging, or production server. In addition to application content (.aspx files, images, XML files, debug files, binaries, and so on), Web applications can require files, settings, and other assets that might be created or tracked in Visual Studio, including the following:
IIS settings such as error pages, default documents, directory browsing and so on.
Assemblies that need to be installed in the GAC on the target computer and COM components.
Application pool settings.
Visual Studio 2010 lets you package your Web application files and settings, and then to provide information about how and where the Web application is to be deployed. Packaging the assets of a Web application makes deploying the application much easier.
The deployment features in Visual Studio are designed to eliminate the manual steps required to deploy many of these settings and assets to an IIS server. The Web packaging technology enables you to create either a compressed (.zip) file or a folder structure called a Web package that contains all the assets and metadata that must be deployed in order to run a Web application. One-Click Publish enables you to create a Web package and deploy it with one mouse click, using a publishing profile that you create.
The Web packaging technology uses the Microsoft Web Deployment Tool (MSDeploy.exe) to deploy a Web package. The Web Deployment Tool must be on the target server. For more information about MSDeploy.exe, see How to: Use MSBuild to Publish a Web Application.
A Web site project is deployed in a different way than a Web application project. A Web site is often copied to the Web server by using the Copy Website menu command under the Website menu. You can also use FTP to copy the Web site files to the server.
Visual Studio 2010 provides two ways to deploy an ASP.NET Web site project. Visual Studio includes the Copy Web Site tool, which copies files of the current Web site to a target server. Visual Studio also includes the Publish Web Site utility, which compiles a Web site into a set of executable files. You can then copy the files to a target server by using any method that you want. For more information about how to deploy Web sites, see ASP.NET Web Site Deployment Overview.
Most hosting companies do not support SQL Server 2008 Express, the database edition that you might have used when developed and tested your Web application. This is because it is not practical for hosting companies to run multiple instances of SQL Server 2008 Express.
Instead, most hosting companies provide access to a full version of Microsoft SQL Server. The hosting company often sets up an account for you on their SQL Server and gives you the connection string to use to log on. Alternatively, they might provide a way to attach an .mdf database file to their SQL Server. This difference has some implications not just for the data that you store as part of your Web site, but for membership, profile properties, and other information that by default is stored in an .mdf file in the App_Data folder of your Web site.
If you are deploying a Web application project, you can use the Publish Database feature in Visual Studio. For more information about how to deploy a SQL Server database together with a Web application, see Walkthrough: Deploying a Database with a Web Package.
The Publish Database features works only with Web applications. It does not work with Web site projects.