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
Install and configure Windows Server AppFabric. For more information, see Lesson 1: Getting Started.
Install the tutorial files. For more information, see Lesson 1: Getting Started.
Deploy the HRApplicationServices workflow service. For more information, see Lesson 2: Deploying the HRApplicationServices Workflow Service.
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
Open IIS Manager by clicking Start and typing inetmgr.
In IIS Manager, expand the Default Web Site and right-click HRApplicationServices application, then click Manage WCF and WF Services and click Configure.
Click Monitoring to see the monitoring configuration. The dialog resembles the graphic below:
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.
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.
In the left panel of the dialog box, click Workflow Persistence.
Under SQL Server Workflow Persistence click the SQL Server store box and select the name of your monitoring database. The default name is defaultSqlPersistenceStore.
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
Open IIS Manager by clicking Start and typing inetmgr.
Select the HRServicesApplication node.
Right-click the node and click Manage WCF and WF Services, then click Configure.
In the left pane click Auto-Start.
Ensure that the setting is set to Enabled(all services will auto-start)
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