Jaa


Lesson 3: Configuring the HRApplicationServices Application

Objective: Use Windows Server AppFabric, accessed through IIS Manager, to configure a Web application for persistence and monitoring. Changes you make in the user interface are made to the Web.config file that defines the configuration for a service or application.

Purpose: To configure AppFabricfor persistence and monitoring.

Prerequisites

Creating a Monitoring and Persistence Store

Monitoring and persistence are two core features of AppFabric. Monitoring simply tracks every workflow and its steps, recording time and status. Persistence stores the actual steps of the workflow and is particularly useful when an error occurs. In that event, the workflow is suspended. When the error is fixed, the tracked workflow can be resumed through AppFabric. The data for monitoring and tracking are contained in two separate databases. You can configure AppFabric to create default databases for these events. Or you can create your own versions of those databases, and instruct AppFabric to use your databases with your application. Alternatively, you could create one database for both monitoring and persistence.

When creating a persistence or monitoring store you must first initialize the new store to make it ready for use. During initialization, the store will be created if it does not already exist (you must have permissions to create stores on the destination server). In the steps below, the database names ApplicationServerMonitoringDB and ApplicationServerWorkflowInstanceStore are used. These names may differ based upon whether your monitoring and persistence databases were already configured before the tutorial was run, and what names were used for them. If they were not configured before you ran the tutorial, use the recommended ApplicationServerMonitoring and ApplicationServerWorkflowInstanceStore names as specified below.

The ContosoHR solution uses database named WF4Persistence database for persistence during development. In the IIS environment you are going to use a different persistence database. You will also configure AppFabric to suspend workflows with unhandled exceptions.

To configure the monitoring store and the persistence store for the application

  1. Open IIS Manager by clicking Start and typing inetmgr.

  2. In IIS Manager, expand the Default Web Site and right-click HRApplicationServices application, then click Manage WCF and WF Services and click Configure.

  3. Click Monitoring to see the monitoring configuration. The dialog resembles the graphic below:

    Configure AppFabric Monitoring

  4. Under Connection String click the drop-down box and select the name of your monitoring database. The default name (created when you set up AppFabric) is AppFabricMonitoringDB.

  5. Ensure that the Level is set to Health Monitoring.

    You should also set the level to higher and lower values to see what kinds of events will be generated. The higher it is set, the more events are generated, and an impact on performance occurs.

  6. In the left panel of the dialog box, click Workflow Persistence.

    Persistence Configuration

  7. Under SQL Server Workflow Persistence click the SQL Server store box and select the name of your monitoring database. The default name is defaultSqlPersistenceStore.

  8. Click OK to close the dialog box.

For more information about monitoring and persistence, see Configure Monitoringand Configuring Workflow Persistence.

Automatically Starting Applications

When auto-start is enabled, a hosted WF or WCF service is instantiated automatically when the IIS service is started by the operating system. The service will automatically start when its server is started. This occurs before the first request is received in order to decrease the initial response time.

To automatically start an application

  1. Open IIS Manager by clicking Start and typing inetmgr.

  2. Select the HRServicesApplication node.

  3. Right-click the node and click Manage WCF and WF Services, then click Configure.

  4. In the left pane click Auto-Start.

  5. Ensure that the setting is set to Enabled(all services will auto-start)

  6. Click OK to close the dialog box.

What Did I Just Do?

In this lesson, you configured the HRApplicationServices workflow application to enable monitoring and persistence, setting the monitoring level as well as the databases used for monitoring and tracking. You’ve also set enabled the application to start automatically, boosting performance.

Next Steps

In the next lesson, Lesson 4: Monitoring the Health of the HRApplicationServices Application, you will run the application and examine the generated events in the AppFabric dashboard.

See Also

Concepts

Lesson 1: Getting Started
Lesson 2: Deploying the HRApplicationServices Workflow Service
Lesson 4: Monitoring the Health of the HRApplicationServices Application
Lesson 5: Resuming a Suspended Workflow Using AppFabric

Other Resources

Lesson 6: Monitoring the Order Service for Exceptions