4

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?

David Makogon
  • 69,407
  • 21
  • 141
  • 189
MoSlo
  • 2,780
  • 4
  • 33
  • 37
  • 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 IIS – Ben Robinson Oct 15 '13 at 09:12
  • 2
    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](http://stackoverflow.com/questions/10941488/what-is-the-difference-between-an-azure-web-site-and-an-azure-web-role/10941526#10941526) that attempts to address this. – David Makogon Oct 15 '13 at 11:09

3 Answers3

4

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.

David Makogon
  • 69,407
  • 21
  • 141
  • 189
  • Good answer, this. I've gotten into Azure only recently and was struggling to understand to underlying difference between web sites and cloud services. It makes total sense now why a staging environment is necessary for a web site. – MoSlo Oct 15 '13 at 12:29
  • +1 for pointing out differences between web sites and cloud services – Costin Oct 16 '13 at 08:35
  • newbie experience, but I have documented my thoughts here - http://vijaytech.net/post/Windows-Azure-Virtual-Machine-vs-Cloud-Services . Hope its of some help – VJVRR Oct 16 '13 at 11:41
  • @VJVRR - your blog post addresses Virtual Machines vs Cloud Services, not what the OP asked. – David Makogon Oct 16 '13 at 12:51
  • 1
    @David - Stealing the chance - I am big fan of your blog / answers on Azure :-). Yes, you are correct, I realized that, I read through the line from OP - "We aim to build versions of the application and then deploy to staging and production environments", so thought will caution him on the things around that. Thanks for correcting me though. I will keep in mind while answering further questions. – VJVRR Oct 16 '13 at 14:42
  • Regarding the staging and production environments, if you choose the "Standard" web hosting plan mode, you're able to create other deployment slots and swap between them. – Rodolphe Apr 09 '14 at 08:53
  • 1
    @Rodolphe - good catch. I answered the original question prior to that feature rolling out. I'll update accordingly. – David Makogon Apr 09 '14 at 10:38
  • The last statement is incorrect. You _can_ push a deployment package to Azure Websites. http://azure.microsoft.com/en-us/documentation/articles/web-sites-deploy/#webdeploy – Oran Dennison Feb 28 '15 at 00:23
  • @oran - In the context my answer, I am talking specifically about a Cloud Service deployment package (cspkg). And you cannot push that type of deployment package to Azure Websites, only to a web/worker Cloud Service. – David Makogon Feb 28 '15 at 04:34
1

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.

Oran Dennison
  • 3,237
  • 1
  • 29
  • 37
1

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.