4
votes

I'm starting an ASP.net web project that will be hosted on Azure, but I'm not certain whether to develop the project as a regular ASP.net application and deploy it as a Web Site on Azure, or to develop it as a Cloud Application with a Web Role.

The project's nature is that of a web site (simple database back-end), but the question is one of deployment. We aim to build versions of the application and then deploy to staging and production environments, meaning the output of a build should result in a single package (similar to what's described in msdn).

There's plenty of information on how to create a service package to publish a cloud service, but articles on publishing a web site to azure follow a 'web deployment' scenario, where deployment is done via Visual Studio (subscription file from Azure etc).

Is there a way to deploy a web site to azure as a package? Or are tools like Visual Studio needed for a web deploy? If so, then is composing the project as a Cloud service with only a web role the correct choice?

3
Look at microsoft deploy, it's what VS hooks into for it's "deploy" mechanism and can be controlled from the command line and via IISBen Robinson
Before thinking about details such as deployment packages, you should consider the core differences between Web Sites and Cloud Services (with Web/Worker roles). I posted this answer that attempts to address this.David Makogon

3 Answers

4
votes

I posted a comment under the question, regarding differences between Cloud Service & Web Site, but to answer your question about packaging: Cloud Services & Web Sites take two different approaches to deployment, and there's not really "works for both" packaging:

  • Web Sites are designed to accept your code deployment from either a source code repository. The idea is that you have a labeled version of your code, and push it out from TFS, git, Bitbucket, etc. You can also push your code up with ftp, or drop it into a dropbox folder. Because Web Sites run in IIS, and because you don't have any control over the VM farm running your Web Sites, you cannot push up startup scripts as you can with Cloud Services; you cannot install registry updates, COM objects, msi's...
  • Cloud Services are designed around a stateless VM model. Every time you scale out (add instances), a baseline Windows Server VM is spun up, and the contents of your deployment package is copied to the new VM instance and executed. This includes startup scripts, installers, etc. Since you have admin-level access to each VM, you can configure it as you need to, from your startup scripts / OnStart(). Definitions for each role are combined into a single deployment package. To update one or more roles, you need to redeploy the package.

Web Sites have no tooling pre-requisites, while Cloud Services require Visual Studio or Eclipse to help you manage the deployment package. You can also use PowerShell and Visual Studio command line tools to build the package, as @Ben Robinson mentioned in the comments above. You can also use PowerShell to create and administer Web Sites. Both Cloud Services and Web Sites provide Staging and Production slots.

You can't push a deployment package to Web Sites.

1
votes

David's answer does a great job covering the Cloud Services option. However, I believe the Azure Website option is well-suited to your needs. You don't have to deploy using Visual Studio. Instead, you can create a publish profile in Visual Studio that creates a Web Deploy Package which is simply a ZIP file that can be published at a later time using command-line tools, no Visual Studio required. It also generates a .deploy.cmd file that you can run to deploy to a remote server, and a SetParameters.xml file with parameters such as connection string that you can modify for your target deployment environment. The .deploy.cmd file calls msdeploy.exe which does the actual deployment.

See this for more details on Web Deploy command-line deployment. There's also a ton of information on MSDeploy and its package system on Sayed Ibrahim Hashimi's blog.

1
votes

If you want to be able to change files directly in the web application then it is best to use an Azure Web App, because you can access those through FTP.

However an Azure Cloud Service does not provide FTP Access, at least not a useful one that would allow you to use an FTP Client to upload files. A Cloud Service is where you do not want to be bothered too much with much of the details of hosting a web application. While an Azure Web App does much of the same thing, it also allows you to have FTP access and direct access to the files post-deployment.