This wiki is to highlight an uploaded MSDN project and to provide some tips and tricks to diagnosing failures with Azure Worker or Web Roles.

Sample Project


The project is a simple illustration of how activity on a worker role could be triggered by a web role via a queue.  The project was inspired by the forum post: Worker role does not start when deploying web application on azure cloud service.

The scenario is where a legacy console application is being run on-demand by a Azure worker role.  An Azure web app provides a user the ability to request the worker role to launch the application.  In this project, an Azure Queue is used to provide a means of triggering the activity on the worker role.  

In order to show that the activity completed, a message is written to an Azure Table.  The architecture is shown below:

The project was created using the Visual Studio Cloud Service template and consists of a worker and web role.  The web role is MVC and supports two buttons: Send Message and Clear Message.  The site will poll the web server for messages written to an Azure Table.  The Send Message button will cause a message to be written to the queue where the Clear Message will clear the messages on the page and remove the row in the table.

The worker role repeats the following steps:

  • Reads a message from the queue
  • Launches a process on the worker role virtual machine
  • Writes the result to the Azure Table
  • Deletes the message from the queue

Please see the project for more details. 

Why the MSDN Project?

The project is a simple example that will hopefully get someone started when they are completely new to Azure and if the use of a Cloud Service matches their requirements.  The project itself does not really add anything more than what has appeared in other posts.

The purpose of the wiki post is to think a little more about why the forum post was made.  One reason is it was not clear why the worker role was not running.  So let's look at some ways one could diagnose the worker role.

Application Insights

The scope of ApplicationInsights is huge and at is literally a tickbox away when deploying the cloud service:


From within the Azure Portal, it is then possible to diagnose issues with the deployment and the initialization of the roles:


View Diagnostic Data


Visual Studio allows for an Azure subscription to be viewed in the Server Explorer.  This provides a convenient way to view diagnostic data, attaching a debugger and to launch an RDP.


In most instances using ApplicationInsights and the Diagnostic summary should indicate what might be going wrong but sometimes it is necessary to RDP.

Once on the server, there is the eventviewer and any file based logging that might be part of the solution.  If the issue is still not identified then sometimes a review of the released components is required (e.g., a missing library).  This can be found on the f drive:


Summary

The main purpose of this Wiki is to provide some tips on how to determine what might be causing a failure in a Cloud Server role.  There are many techniques and above are provided some useful ones.

Please comment other tips and tricks that might be helpful.