Deploy ASP.NET Website to Windows Azure
Yeap, you’re not looking at the wrong title, it is ASP.NET Website, not ASP.NET Application.
As you might have known, since Windows Azure SDK 1.5, you can add Windows Azure Project to your existing ASP.Net web application with few clicks. After that, VS2010 will automatically add Windows Azure project and reference the necessary dlls.
What happened was that I couldn’t deploy website to Windows Azure as Windows Azure project in VS2010 won’t allow me to add Windows Azure project to it (no option as you can see below). I’ve tried to migrate the website to web application but it is too troublesome as there are just too many websites to be converted in my case and there are many DLLs that will need to be added.
Thanks to David Aiken’s blogpost, I had use the same method to package my file to Windows Azure. However, there are some changes in Windows Azure SDK (which is v1.6) now compared to the version that David used (which is SDK 1.2).
Reminder: You will need to publish/compile the website if you had made any changes to it to generate the necessary DLLs.
- Put your website in another folder or create a new one. Something like the image below. So my website files are inside ASPWeb folder.

- Copy ServiceConfiguration.cscfg and ServiceDefinition.csdef into the new folder that you created in Step 1. If you doesn’t have the file, then please use the code as below. You can create them using notepad.
- ServiceDefinition.csdef(Configured as ExtraSmall instance)
<?xml version="1.0" encoding="utf-8"?> <ServiceDefinition name="WindowsAzureProject1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition"> <WebRole name="ASPWeb" vmsize="ExtraSmall"> <Sites> <Site name="Web"> <Bindings> <Binding name="Endpoint1" endpointName="Endpoint1" /> </Bindings> </Site> </Sites> <Endpoints> <InputEndpoint name="Endpoint1" protocol="http" port="80" /> </Endpoints> <Imports> <Import moduleName="Diagnostics" /> </Imports> </WebRole> </ServiceDefinition> - ServiceConfiguration.cscfg
<?xml version="1.0" encoding="utf-8"?> <ServiceConfiguration serviceName="WindowsAzureProject3" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*"> <Role name="ASPWeb"> <Instances count="1" /> <ConfigurationSettings> <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" /> </ConfigurationSettings> </Role> </ServiceConfiguration> - Change the RoleName inside both ServiceDefinition.csdef and ServiceConfiguration.cscfg to reflect the name of the folder that contains your website. In my case, ASPWeb.
- You can also rename your Site Name. In my case, I leave it as it is which is “Web”.
- Run Windows Azure Command Line Tool As Administrator
- CD to your website directory. For example : cd C:\Desktop\\Website2
- Execute this command.
cspack ServiceDefinition.csdef /role:{yourrolename};{roledirectory} /sites:{rolename};{sitename};{directorytoyourwebsite} - Example:
cspack ServiceDefinition.csdef /role:ASPWeb;ASPWeb /sites:ASPWeb;Web;C:\DesktopWebsite2 - After that, you’ll see .cspkg is created.
- Upload the .cspkg and .cscfg file using Windows Azure Management Portal. Then there you go!
Hope this is helpful for you






