Cloud Template and Skeleton Roles and Projects

A COBOL template is provided for creating a solution for a cloud application or service, with projects for the web and worker roles you choose.

Cloud Service for COBOL

The main project is the cloud service. It defines the roles in the service and contains associations to the roles' projects in the solution.

The properties for each role define its configuration settings, connection settings, end points, local storage resources and more. You edit these settings through the role's properties.

The service definition and service configuration files are xml files representing the roles' properties. The service definition file establishes the run-time parameters for the service and the service configuration file sets the parameters for a running instance of a service.

By default, the Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString for each role is set to use the storage emulator. This specifies the storage account that Microsoft Azure Diagnostics will use to transfer logging data. Before you deploy your service, you set the cloud configuration to point to a valid storage account in Microsoft Azure.

To use Microsoft Azure queue storage, you need to set the DataConnectionString to use the storage emulator.

ASP .NET Web Role for COBOL

The web role is the presentation layer for the application. The skeleton web role comprises:

  • Default.aspx and the code behind in Default.aspx.cbl - Two partial classes that make up a skeleton Web page with controls for the user to interact with your application. You can view the page in the Designer, both as HTML source and as the finished design.
  • About.aspx and the code behind in About.aspx.cbl - Similar to Default.aspx, two partial classes that make up a skeleton About page.
  • Global.asax and the code behind in Global.asax.cbl - The class that handles starting and stopping the application and session.
  • WebRole.cbl - The class containing the methods to start and stop the web role.
  • Web.Debug.config and Web.Release.config - Configuration for the web role.
  • References to Microsoft Azure classes, such as MicroFocus.COBOL.Runtime.Azure, Microsoft.WindowsAzure.ServiceRuntime and Microsoft.WindowsAzure.Diagnostics.

WCF Service Web Role for COBOL

This web role is for use with WCF services. The skeleton web role comprises:

  • IService1.cbl - The interface to your WCF service. You add your service operations here.
  • Service1.svc and the code behind Service1.svc.cbl - The class containing the methods to get data and use the data contract.
  • WebRole.cbl - The class containing the methods to stop and start the web role.
  • Web.config - Configuration for the web role.
  • AzureLocalStorageTraceListener.cbl - The class to get the log directory for trace information.
  • References to Microsoft Azure classes, such as MicroFocus.COBOL.Runtime.Azure, Microsoft.WindowsAzure.ServiceRuntime and Microsoft.WindowsAzure.Diagnostics.

Worker Role for COBOL

The worker role is similar to a web role but isn't hosted by Internet Information Services (IIS). You usually use the worker role for background processing, such as communicating with the web role and your business logic.

The skeleton worker role includes WorkerRole.cbl - A skeleton COBOL program, which writes a line repeatedly, so that you can see it working. You add you business logic to the skeleton code in this role. It contains the following methods:

  • Run - Run the role.
  • OnStart - Initialization. Start the DiagnosticMonitor and set up delegate to handle role changes.
  • RoleEnvironmentChanging - Handles changes in configuration or environment settings.

Similar to the web roles, the worker also includes references to Microsoft Azure classes, such as MicroFocus.COBOL.Runtime.Azure, Microsoft.WindowsAzure.ServiceRuntime and Microsoft.WindowsAzure.Diagnostics.