2
votes

I'm planning to do some light background processing in Azure. I already have a webrole running and would like to use the same role in order I don't have to use (and pay!) a dedicated worker role for that.

I have read I can simply override Run() in the WebRole class, which derives from RoleEntryPoint, and implement my 'poor man's scheduling' there. It should periodically get messages from the queue and process them.

Now my question is: Does the WebRole run in its own process or thread, or more important, what happens with WebRole when the app pool/app domain gets recycled?

2

2 Answers

2
votes

If you are running with Full IIS mode (available 1.3 SDK onwards), the RoleEntryPoint and IIS are in different processes. You will know you are using Full IIS mode if you have a <Sites> element in your ServiceDefinition.

IIS actually runs your website in w3wp.exe (just like you would expect normally) as it's own appPool. The RoleEntryPoint code is launched and parented by a completely different process, so there is no tie between them (crashing one will not impact the other for instance).

2
votes

To add to @dunnry's answer; what is also interesting, is that run is called on a copy of your assembly in this folder:

e:\approot\bin

Whereas IIS is pointing to another copy of your application in this folder:

e:\siteroot\0