I’ve been playing around with the Beta 1 of the Windows Server AppFabric that was recently released by Microsoft. Windows Server AppFabric combines the WCF/Workflow services hosting solution formerly known under codename ‘Dublin’ and the distributed caching solution formerly known under codename ‘Velocity’. This post focuses on the WCF/WF Services hosting part.
I’ve installed the AppFabric software on a Windows 7 box containing .Net 4 and Visual Studio 2010 Beta 2. After the installation the IIS Manager is extended with an additional section named ‘Application Server Extensions for .Net 4’. I will show the different parts of this section throughout this post:
To test the new features I fired up Visual Studio 2010 and created a simple declarative workflow-service named ‘RememberService’. It uses the .Net 4 messaging activities to model the service-operations. The functionality of this service is very simple. You first call the ‘Remember’ operation which expects a single parameter called ‘item’ (a string value representing some item to remember). The workflow stores the value in the workflow and returns a ‘RememberID’ which will be used for correlation. The user can later call the ‘Recall’ operation which expects a single parameter called ‘rememberId’. Using the new content based correlation feature of WF 4 the workflow-instance corresponding to the specified ‘rememberId’ is activated and the workflow will return the item that was stored earlier.
After building and testing the service, I opened the IIS Manager and created a new ASP.Net application using an ASP.Net v4.0 application-pool:
After that I published my service to this application. After verifying that the service worked correctly in IIS, I was ready to start using the AppFabric features. When I open the ‘Services’ option of the ‘Application Server Extensions for .Net 4’ section in the IIS Manager, I can see information of the service I’ve just published:
To configure the service, I right-clicked on the corresponding ASP.Net application which reveals a menu called ‘.Net4 WCF and WF’ that has a ‘Configure…’ option:
Here I can configure the AppFabric features for this ASP.Net 4 application. First I enabled a cool AppFabric feature called ‘AutoStart’. When AutoStart is enabled for an application, it will automatically be started when the web-server is started. This drastically reduces the initialization time that you experience when a service is first called:
After that I wanted to look at the monitoring feature. First I opened the ‘Monitoring Database Configuration’ option of the ‘Application Server Extensions for .Net 4’ section in the IIS Manager. I added a monitoring database called ‘ServiceMonitoring’ by right clicking the database-list and choosing ‘Add…’:
The database was added to the list but had the status ‘Uninitialized’. I right-clicked on the database and chose the option ‘Initialize database…’. Automatically all the necessary database-objects for storing the monitoring data were created in the database. After that I reopened the .Net 4 WCF and WF configuration-screen for my RememberService and configured monitoring with level ‘Troubleshooting’ (which means all available monitoring information is captured):
I called the Remember and Recall operations on the RememberService and opened the ‘Dashboard’ option of the ‘Application Server Extensions for .Net 4’ section in the IIS Manager to view the monitoring information:
You can see that the two calls (Remember and Recall) are perfectly recorded. Clicking on the ‘Completed: 2’ tag reveals more information regarding the calls:
When I right-click one of the calls in the grid and select the option ‘View all related events’ more detailed monitoring information is shown:
Pretty cool stuff so far in my humble opinion! But we’re dealing with a workflow-service here and I would like to monitor and manage the workflow-instances. To be able to do this, I created and initialized a persistence database called ‘WorkflowServicePersistence’ just like I did for monitoring. After that I configured workflow persistence using the .Net 4 WCF and WF configuration-screen for the RememberService:
In the Advanced dialog I chose the following options:
I called only the Remember operation on my service and checked the workflow-instance information using the ‘Dashboard’ option of the ‘Application Server Extensions for .Net 4’ section in the IIS Manager:
Through this dashboard I can see exactly what’s going on with my workflow-instances. I can also drill-down by selecting an instance and looking at several events and tracking information that is captured for the instance. I can also right-click an instance and execute commands for this instance. I selected my persisted workflow and issued the ‘Suspend command’:
The command will be queued in the persistence database and is visible in the dashboard as pending command. A Windows Service called the ‘Application Server Workflow Management’ service (configured to look in the persistence-database) will pick these commands up and execute them. After that, my workflow-instance is in the ‘Suspended’ state:
As to be expected, calling the Recall operation on my service while it is suspended yields an error indicating that de service is unavailable. Giving the instance the ‘Resume’ command will return it to the Running (Idle) state. Now I can call the Recall operation and the service will execute and finish without a problem.
In this post I’ve provided a very quick overview of some features of Windows Server AppFabric. To get more detailed information and guidance, check the corresponding MSDN site at: http://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx