.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh

Home >> Articles >> Azure >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Azure Part 8: Creating a Worker Role

Posted By:Jean Paul       Posted Date: October 12, 2011    Points: 200    Category: Azure    URL: http://www.dotnetspark.com  

Creating a Worker Role

Creating a Worker Role 

In this article we are creating a worker role using Visual Studio 2010.  This will make the reader familiar with Windows Azure. 

Open Visual Studio 2010 and use the command New Project.  From the appearing dialog box select the Windows Azure Project option from Visual C# group. 



Enter an appropriate name for the project and click Ok to continue.  Now you will be prompted with another dialog for selecting the type of project. 


Double click on the Worker role option to select a worker role project and click Ok button.



Now you are ready with the Worker role project.


Purpose of Worker Role 

The Worker role can be used to host WCF services, provide endpoints, perform operations etc.


The default Run() method implementation contains an infinite loop as shown below:


 public override void Run()


            // This is a sample worker implementation. Replace with your logic.

            Trace.WriteLine("WorkerRole1 entry point called", "Information");


            while (true)



                Trace.WriteLine("Working", "Information");




Now execute the application and you will be able to see the application inside the browser.  From the system tray, you can verify the Windows Azure Emulator as running.


If successfully executed, you can see the trace output messages as shown below.



Exceptional Cases 

The exceptional cases are already addressed in the previous Web Role Example article.

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend