Questions tagged [azure-web-roles]

A Microsoft Azure Web Role is a Windows Server Compatible Virtual Machine (VM) with IIS enabled, along with scaffolding code that provides a launch point for your own code to run within the VM.

Web Roles and Worker Roles form the basis of the Azure Cloud Services PaaS offering, removing the need for developers to manage the platform on which their applications will run.

The primary difference between a Web Role and Worker Role is the enabling of IIS. Both Web Roles and Worker Roles may run the same code, though it's often useful to split code between different roles for scaling purposes.

Within Visual Studio, you'll also see a slightly different role template, but the 4 primary events/overrides are available in both:

  • OnStart()
  • Run()
  • Stopping()
  • OnStop()

Further: If apps need to be installed (or registry changes are needed), and those tasks need elevated privileges, there's the ability to run startup tasks, which execute prior to OnStart().

In either roles you can choose the type of operating system running by modifying the service configuration file (.cscfg). Possible options are:

  • osFamily 1: equivalent of Windows Server 2008 SP2 x64
  • osFamily 2: equivalent of Windows Server 2008 R2
  • osFamily 3: equivalent of Windows Server 2012
  • osFamily 4: equivalent of Windows Server 2012 R2

You can read more about service configuration schema here.

1139 questions
8
votes
2 answers

Azure and Publish on buildserver. Need to specify the physical directory for the virtual path

I'm getting some strange errors from the build server in the CSPack step when build a Cloud Service (Web Role) project with the Publish target on a build server. Publish through Visual Studio 2012 works fine, but not on the build server. Error…
John Korsnes
  • 2,277
  • 2
  • 20
  • 31
8
votes
2 answers

How to manually change the worker role files on cloud by doing RDP?

Pushing full cloud service project on to cloud is very time consuming, so if its some minor changes and I want them to reflect immediately then i RDP into the web role and make those changes and restart the IIS. Can something like this be done for…
Bitsian
  • 2,238
  • 5
  • 37
  • 72
8
votes
1 answer

Entity Framework DbContext in Azure Web Role

I am migrating an existing Web Application (using Entity Framework 5) to an Azure Web Role. The database connection string is being moved from the web.config to the ServiceConfiguration.*.cscfg files. The problem is that in the auto-generated…
Dave New
  • 38,496
  • 59
  • 215
  • 394
8
votes
3 answers

How to get aspnet_compiler invoked from Visual Studio during build?

I want Visual Studio to precompile my ASP.NET application which is used as an Azure web role payload. So I've found this post that explains how to call aspnet_compiler to validate views. I tried to add the following to "post-build event" of my…
sharptooth
  • 167,383
  • 100
  • 513
  • 979
8
votes
1 answer

Azure CDN - Enabling HTTP 304 Caching with ETag - Hosted Web Role

We are trying to enable HTTP compression (gzip) and HTTP 304 Caching via ETags on Azure CDN. We already discovered an issue with enabling Azure CDN Compression, but now we can't get compression and ETag caching (304s) working simultaneously. This…
8
votes
4 answers

In Azure, Where should I store physical files that need to be accessed by a Worker Role?

In Azure, Where should I store physical files that need to be accessed by a Worker Role? In my case I would normally store these particular files in my Web Role's App_Data folder but I don't believe that Worker Roles can access that folder.
David P
  • 3,604
  • 3
  • 37
  • 54
7
votes
2 answers

Automatic start of Azure webrole after deploy

A have an azure webrole with a test page and a service in that role. After publishing the role it doesn't start automatically, only at first use. So if the role is shut down for some reason the first usage after that is quite slow. Is there a way to…
Attila Klenik
  • 753
  • 6
  • 13
7
votes
2 answers

Orchard Performance on Azure

Using http://docs.orchardproject.net/Documentation/Deploying-Orchard-to-Windows-Azure I've successfully deployed Orchard into Azure. After every 20mins or so without activity (app pool recycle?) it takes minutes to render a page. I'm running on an…
Dave Mateer
  • 6,588
  • 15
  • 76
  • 125
7
votes
2 answers

Azure Roles and Instances

Can I have a Web Role and a Worker role run on the same instance, or do I have to obtain 2 separate hosting instances and pay twice the amount I would otherwise? I have a WCF Web API that I want to host on Azure. I also have a Worker Role that…
Anup Marwadi
  • 2,517
  • 4
  • 25
  • 42
7
votes
3 answers

Environment.GetEnvironmentVariable("RoleRoot") returning null when called in a WebRole

I have a method (in a separated class library) which is called by a WebRole and a WorkerRole. This method contains the path of a file, which is returned using Environment.GetEnvironmentVariable("RoleRoot"), as follows: private string FooPath() …
Davidson Sousa
  • 1,353
  • 1
  • 14
  • 34
7
votes
4 answers

How to bypass warnings when targeting .Net 4.5.2 during publish

My Azure services target .Net 4.5.2 and run fine in dev. However, build produces the warning(s): Warning The project 'SurfInfoWeb' targets .NET Framework 4.5.2. To make sure that the role starts, this version of the .NET Framework must…
Bill O
  • 315
  • 4
  • 13
7
votes
4 answers

Build error after upgrade Azure SDK from 2.4 to 2.6

I just upgraded my web role project (and solution) from Azure SDK 2.4 to Azure SDK 2.6 using the upgrade functionality under project properties > application. When I am building my application, everything works well but when I try to run it (and…
Hans Leautaud
  • 1,742
  • 1
  • 19
  • 34
7
votes
3 answers

Missing Microsoft.WindowsAzure.Diagnostics assembly

I got the following exception when my WebRole tries to start: {"Could not load file or assembly 'Microsoft.WindowsAzure.Diagnostics, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located…
Mahmoud Samy
  • 2,822
  • 7
  • 34
  • 78
7
votes
6 answers

Azure websites ftp upload fails on some files but not others

I've tried uploading an ASP.Net MVC site to an Azure website account and I'm running into a serious problem. Most files will transfer fine but a few will ALWAYS fail.The trouble is that it is always the same files that fail and I cannot figure out…
user2646672
  • 71
  • 1
  • 3
7
votes
4 answers

After adding HTTPS endpoint I get this warning: 'Microsoft.WindowsAzure.Plugins.PasswordEncryption' was not found in the certificate store

I added an HTTPS endpoint to my WebRole, and now I'm getting the following warning when I attempt to run the Azure Emulator, which causes the compute emulator to stop and the debugger to bail: Warning: The SSL certificate…
w.brian
  • 16,296
  • 14
  • 69
  • 118