Hi I have created a new azure project with a worker role and have noticed a class WorkerRole.cs. I tried researching on what it’s purpose is however I couldn’t find a straight answer.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The goal of the WorkerRole.cs is to give you an entry point to execute “something” when the Worker Role instance starts. This could be a command line application you’re starting, or a WCF service, or MySQL, … anything you want.
Note that you’ll need to write code to keep the instance ‘alive’. If you don’t do this, it will restart when the Run method completes. Take a look at the following question for more information: Using Thread.Sleep or Timer in Azure worker role in .NET?