You can use Visual Studio to build, run, and debug your application locally (using your localhost server) as you would any application. Visual Studio also simplifies publishing to Azure when you are ready to post the build to a server (typically for testing, but it can also be used for production).
To get started, you can use the Publish link inside the Web Publish Activity (View, Other Windows, Web Publish Activity), as shown at the bottom of Figure 12.10. This dialog makes executing a publish activity quick (using the toolbar) and allows you to see the activity results as they happen. However, the first time you set up your publishing profile, you will want to use the Publish Web Wizard. You typically access this by right-clicking the web application inside Solution Explorer and choosing Publish.
Figure 12.11 shows the Profile screen inside the Publish Web Wizard. From here you can select which publishing profile you want to configure (using Manage Profiles). Having multiple publishing profiles allows you to deploy the same application to different environments with different settings. Notice, too, that you can select the publish target as an Azure web app or VM. Doing so downloads the configuration from Azure for the given environment.
The next step is to set the Connection information for your selected publishing profile. Most of this information should be configured already by Visual Studio on your behalf. Figure 12.12 shows the Connection information for publishing a website to Azure. The first option, Publish Method, allows you to set the publish method as a web deployment (via HTTP), create a web deployment package (to be deployed by a deployment service), use FTP, or use the file system for deployment. In this case, we have selected Web Deploy.
You will also want to click the Validate Connection button, as shown in Figure 12.12. This ensures your Web Deploy can connect to the environment for deployment.
The next step in the wizard is to configure the deployment settings. Figure 12.13 shows an example. The Configuration drop-down allows you to select a Debug or Release build for the application deployment. This makes sure the appropriate Web.config
version is published with your web application. (Typically the Debug version points to debug data/server settings and the Release version points to production.) The File Publish Options allow you to set whether files should be removed from the destination, precompiled during publishing (to eliminate “warm-up” for first-time access), or exclude any test data you might have in the App_Data
folder. Finally, if you have a database associated to the application, you would set that information here, too.
The last step in the Publish Web Wizard is shown in Figure 12.14. Here you can create a preview of your deployment. Clicking Start Preview runs the publish profile and determines actions to be taken by file. Figure 12.15 shows the results by file.
The last step is to click the Publish button. This kicks off the publish activity and shows the results inside both the Output and the Web Publish Activity windows. Once the publish activity has succeeded, Visual Studio will launch your site in a browser for verification. Figure 12.16 shows the site running inside a browser. (Notice the temporary URL.)
Note
Subsequent deployments do not need to go through the wizard. Once they’re configured, you can kick off another deployment from the Web Publish Activity window using the toolbar at the top of the window. (Refer to Figure 12.10, where the toolbar is grayed out because the profile configuration has yet to be set up.) Here you select a publish profile and click the Publish Web icon next to the selected profile. This will redeploy your site using the same configuration you set up previously.