Deploy your legacy ASP.NET Web Site to Windows Azure Web Sites

This is a follow up post for an answer on StackOverflow.

There are plenty of tutorials on the official Windows Azure website about deploying an ASP.NET Web Application to Windows Azure Web Sites. You simply need to download the publish profile, import it in Visual Studio and click the Publish button. That’s pretty easy if you have a Web Application.

Before the release of Windows Azure Web Sites there were a few ways to deploy an ASP.NET Web Site to a Windows Azure Web Role. You could convert the Web Site to a Web Application (which I had to do for a customer, and this wasn’t fun), or you could play around with cspack.exe. Let’s take a look how easy it is to leverage Windows Azure Web Sites to deploy your ASP.NET Web Site with Visual Studio.

Creating the Web Site

Creating a Web Site is pretty easy, simply go to the Portal and navigate to New > Compute > Web Site. There you get to choose a name for the Web Site and the region in which it should be hosted:

You could deploy the ASP.NET Web Site through a repository (GitHub, BitBucket, TFS, …) but let’s assume we want to do this from Visual Studio. In that case it’s important to create deployment credentials (if we don’t have any) and to find the FTP hostname for our Web Site. You’ll be able to do all of this on the dashboard:

Publish

Now that we have our Web Site it’s time to deploy our Web Site. Right click your Web Site and you’ll see a few options similar to those you would have on a Web Application:

Click the Publish Web Site button and you’ll see the following window:

By clicking the small button new to the Target Location you’ll be able to choose an FTP Server and this is where we need to enter the information we found on the dashboard:

Fill in the FTP hostname, username and password (you get these after clicking Reset deployment credentials in the dashboard). Make sure you check the Passive Mode checkbox. Finally you’ll need to fill in the exact path to the website’s root directory: site/wwwroot

Now click Openand then click OK to start the deployment. You’ll be prompted to enter your credentials again which you’ll need to do in order to proceed. Wait a few minutes for the deployment to complete and you’re finished:

Enjoy!

About Sandrino Di Mattia

Sandrino Di Mattia is a Windows Azure Consultant at RealDolmen and a Windows Azure Insider. He lives and breathes Windows Azure.