Logo
PREGNANCY
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
 
 
Windows 7

Visual Studio 2010 : Deploying Web Applications

7/21/2011 4:44:24 PM
Deploying Web applications is more complicated than deploying Windows applications. One key difference is what occurs during the build process. Windows applications are compiled into assemblies. You can distribute those assemblies by any means you want. Visual Studio provides a number of tools to assist with the distribution of Windows assemblies, as described in the preceding section.

Web sites are different. When you use the Build command with a Web site, Visual Studio compiles the page only for testing. You can't deploy the output created from the Build command — and you don't need to. Because ASP.NET Web sites are compiled on demand when users access the Web site, you can just copy and paste your Web site, if you want.

You may want to compile your Web sites before you deploy them, which is often called precompiling. Precompiled Web sites have these benefits:

  • They start faster because no performance hit occurs while the requested page compiles.

  • Source code isn't deployed to the Web server; only assemblies and static files are.

  • You get feedback from compiler errors before the Web site is deployed.

Next, the deployment begins. Web sites often have two stages of deployment:

  • Test server: When a Web site is first created, it may be initially deployed to a test server. Several developers and testers can access the test site. The test site usually remains up after the site is deployed to production. The test site provides a working copy of the production Web site, where changes can be made.

  • Production server: After a site is ready to go live, it's published to a production Web server.

In reality, several versions of the Web site can run on different test servers. Developers can also have local copies of the site running on their development machines. They may deploy their local copies to the test server.

Because of the nature of Web sites, they're often changed more frequently than Windows applications. Changes are usually made to a single page or a set of pages, and then only those changes are deployed. In other cases, the entire Web site may be deployed.

NOTE

Making frequent changes to the structure, layout, and design of a Web site can be disruptive to your site's visitors. As a result, more firms are starting to limit the number of changes they make to the site. Rather than change the site, firms are creating fluid sites that use content databases and configuration files to control the site's content and flow. Rather than change the Web site when you want to change content or the site flow, changes are made to content databases or configuration files.

Whether you're deploying to a test server or a production Web server, Visual Studio provides several options for deploying Web sites:

  • Web setup project: Packages your Web site by using an installer that you then execute on the Web server

  • Copy Web Site tool: Copies and synchronizes sites between a local store and a server

  • Publish Web Site: Precompiles the Web site and copies it to the target of your choice

  • Web Deployment Projects: This add-in gives you the most flexibility in precompiling your Web site

You can also just copy and paste your files from your test server to production. The major drawback of copy-and-paste strategies is that you can easily make mistakes.

1. Using the Publish Web Site utility

To use the Publish Web Site utility in Visual Studio, follow these steps:

  1. Open your Web site in Visual Studio.

  2. Choose Build=>Publish Web Site.

    The Publish Web Site dialog box, shown in Figure 1, appears.

  3. Specify a target location where the Web site should be copied.

    You can enter or browse to a URL, Universal Naming Convention (UNC), or local file path.

  4. Select the Allow This Precompiled Site to Be Updateable option.

    This feature copies your ASPX files as-is to the Web site. You can update these pages later without having to recompile and deploy the entire site.

  5. Click OK.

    All code-behind files are compiled into a single assembly. The assembly, ASPX files, and static files (such as images) are copied to the target location that you specify in Step 3.

Figure 1. All necessary files will be published with your Web site.

Make a backup of your production Web site before deploying a new Web site. If the new site doesn't work, you can quickly roll back.


2. Handling web.config files for testing and production

A common challenge when you're deploying Web sites is not overwriting the web.config file. The web.config file on a test server usually has different settings than on a production server. For example, the test server may have connection strings that point to test databases. Visual Studio 2010 automatically creates a web.debug.config and web.release.config file for you and gives you control over precompilation and other deployment settings.

To configure deployment of an ASP.NET Web project, follow these steps:

  1. Choose Build=>Publish Web Site.

    The Publish Web dialog box appears, as shown in Figure 2.

  2. Choose Publish.

    Visual Studio creates a web.release.config file and publishes the Web site with your settings.

You configure a group of property page settings for each build configuration. For example, you likely don't want to use the deployment project with your debug build configuration. You can create different deployment settings for staging and release build configurations.

Build your site by using the release configuration. The web.config file is merged with the .config file. And you have a release version of your Web site that you can deploy to your production server, using whatever method suits you.

Figure 2. The Publish Web dialog box.
Other -----------------
- Visual Studio 2010 : Deploying Smart Client Applications (part 2) - Making a Windows Installer
- Visual Studio 2010 : Deploying Smart Client Applications (part 1) - From No Touch to ClickOnce
- Microsoft Visio 2010 : Applying Themes to Your Diagrams (part 2)
- Microsoft Visio 2010 : Applying Themes to Your Diagrams (part 1)
- Microsoft Visio 2010 : Turning Off the Grid
- Managing Disks : Using the Disk Management Utility (part 2) - Understanding the Disk Management Utility
- Managing Disks : Using the Disk Management Utility (part 1) - Using the Microsoft Management Console
- Managing Disks : Configuring File Systems & Configuring Disk Storage
- Microsoft Excel 2010 : Saving and Managing a Chart Template
- Microsoft Excel 2010 : Adding and Deleting a Data Series
- Microsoft Visio 2010 : Using the Format Painter
- Microsoft Visio 2010 : Applying Line Styles and Colors
- Managing the Windows 7 Environment : Managing Windows 7 Services
- Managing the Windows 7 Environment : Configuring Advanced Power Settings
- Managing the Windows 7 Environment : Configuring Mobile Computing
- Visual Basic 2010 : Exposing .NET Objects to the COM World
- Visual Basic 2010 : Importing and Using COM Objects
- Microsoft Visio 2010 : Applying Color and Fill Patterns
- Microsoft Visio 2010 : Using the Auto Align & Space Feature
- Managing the Windows 7 Environment : Configuring Remote Connections (part 3) - Configuring a VPN Connection
 
 
Most view of day
- Microsoft LynServer 2013 : Firewall and Security Requirements - Reverse Proxy Configuration (part 3) - Configuring Authentication and Certification on IIS Virtual Directories
- Windows Server 2012 Requirements and Installation : Switching Between Install Modes
- Maintaining Dynamics GP : Resolving errors with the Check Links utility
- Using the Windows 7 Libraries : USING NON-FILESYSTEM CONTAINERS
- Microsoft Systems Management Server 2003 : Understanding Status Summarizers (part 2) - Configuring Status Summarizers - Component Status Summarizer
- Designing an Update Management Strategy : Updating with System Center Configuration Manager
- Microsoft Content Management Server Development : Validating Placeholder Controls - Validating the SingleImagePlaceholderControl
- System Center Configuration Manager 2007 : Operating System Deployment - Task Sequences (part 1) - Variables
- Microsoft Visio 2013 : Collaborating on and Publishing Diagrams - Saving Visio drawings to SharePoint 2013
- Microsoft SharePoint 2013 : Working with Visio Services - Designing dashboards - Data linking (part 3) - Mapping external data to shapes
Top 10
- Microsoft Sharepoint 2013 : Understanding app patterns (part 5) - Building MVC apps - Introducing MVC4
- Microsoft Sharepoint 2013 : Understanding app patterns (part 4) - Building MVC apps - Understanding web form challenges
- Microsoft Sharepoint 2013 : Understanding app patterns (part 3) - Building MVVM apps - Utilizing promises
- Microsoft Sharepoint 2013 : Understanding app patterns (part 3) - Building MVVM apps - Utilizing promises
- Microsoft Sharepoint 2013 : Understanding app patterns (part 2) - Building MVVM apps - Introducing knockout
- Microsoft Sharepoint 2013 : Understanding app patterns (part 1) - Building MVVM apps - Understanding JavaScript challenges
- Microsoft Access 2010 : Report Properties and Why to Use Them, Basing Reports on Stored Queries or Embedded SQL Statements
- Microsoft Access 2010 : Working with Sorting and Grouping (part 2) - Sorting and Grouping Settings
- Microsoft Access 2010 : Working with Sorting and Grouping (part 1) - Add Sorting and Grouping to a Report
- Microsoft Access 2010 : Building Reports Based on More Than One Table (part 3) - Working with Subreports
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro