Windows Server AppFabric Hosting

After looking at Part 1, let’s look at the feature for Hosting that Windows Server AppFabric provides in addition to the .NET Framework.

1)     Windows Server AppFabric Service Management Service

There are mainly two scenarios why we implemented the service Management Service in Dublin. They are:

A    Batch processing

a.     The scenario is that you want to batch process orders at off peak times or weekend. Typically this scenario is that a web application takes the order and puts it in the queue, and the orders are processed from at the end of the day when servers are typically otherwise idling.

B    Support Windows Server AppFabric Workflow Management Service

b.     The Workflow Management Service (WMS) is responsible for resuming “runnable” durable instances. See Introduction to AppFabric blog entry for details. This service uses the Service Management Service as a mechanism to start the WorkflowServiceHost. This is an implementation detail of the Windows Server AppFabric Workflow Management Service.

To support the above requirement there needed to be a protocol agnostic way to start a service and so we introduced the Windows Server AppFabric Service Management Service, which enables starting any service (registered with the application environment) within the application.

How-To

The first question to ask is “How do I address this service?” To demonstrate this with an example.

http://www.store.com/Services/dvd.svc/titleInfo

Above is a URI  of a dvd.svc .Remember the fact that Service Management service is an independent service, which resides in every virtual application, and is capable of being activated over the named.pipe transport protocol.

It implements an IServiceManagement interface, which contains the ActivateService method, with one parameter the virtualPath.

Returning to our example, let’s say the above dvd.svc is deployed in the virtual application called “Services”.

To construct URI of the Service Management service

1)     Replace the protocol the service URI with net.pipe

2)     Replace the hostname with the appropriate host header specified in the site binding

3)     Remove the relativeServicePath and append it rest of the path with /ServiceManagement.svc

So for this example, the Service Management Service can be specified with

net.pipe://localhost/Services/ServiceManagement.svc  

Typically to start a service, you could envision a application which takes a service URI, calculates the SMS URI, and pings the application.

2)     Autostart WCF/WF Services  

One issue when hosting services in IIS is the “first message latency” message delay or the the requirement to “Warm-up” the application, in advance of the first message.

Autostart is a feature introduced in Windows 7 and Windows Server 2008 R2 which allows you to achieve this. It provides “Warm-up” and the “Always Running” semantics. Additionally, It removes the need to write a WAS host aware transports, otherwise known as Listener Adapters.

You should use this feature for primarily two reasons

a.     Reduce the latency incurred by the first message.

b.     Hosting WCF transports/protocols for which there are no Listener Adapters. The trade-off is site density

This feature is supported only on the Win7 and Win2008 R2 platform.

How-To:

Windows Server AppFabric provides configuration support in IIS Manager to Autostart the application.

1.     Navigate to the Application

2.     Click on Configure in Actions pane

3.     Configure the Application to either by choosing

a.      Enabled which will  autostart all the services

or

b.     Custom option, which will  autostart only the specific services.

To Autostart an individual service, you will need to navigate the configuration panel for that specific service.

To summarize, we made hosting investments , in both the framework and Windows Server AppFabric,  primarily focusing on the following aspects

1)     Easier WCF service configuration and management

2)     Enable activation and execution of Worflow  in WAS

3)     Enhance the existing “application environment” capabilities in WAS by providing additional semantics like “Always Running” and “Scheduled Start”  for web services.