Skip navigation

Manage Services with Windows Server AppFabric

Take a tour of the feature set

By the time this article is in your hands, Windows Server AppFabric should have been released in RTM form. This article will give you a foundational understanding of what AppFabric offers and ultimately convince you that you should be using it! If you are building services to run on the Windows Server platform, using AppFabric to host and manage your WCF Services is simple.

Overview of AppFabric 

AppFabric is a platform designed to simplify and empower your middle tier, so its feature set can be somewhat overwhelming. When considering your middle tier, simply keep these five points in mind about AppFabric:

  1. It simplifies monitoring services in production and troubleshooting during development.
  2. It vastly reduces the amount of hand XML configuration you need to apply to web.config, giving you intelligent configuration UIs that minimize user error and save you time.
  3. The tooling it provides empowers both the developer and the IT pro roles.
  4. It is a robust, reliable, and scalable host for WCF Services.
  5. It is useful for all WCF Services, be they code-based services or workflow services.

This last point is important if you played around with the betas, since you may have thought AppFabric was only useful for managing workflow services. While it's true that it has a lot of functionality for workflow services, it has been enhanced to assist with the management and monitoring of all WCF Services hosted in AppFabric. With those five key points in mind, let’s examine AppFabric’s feature set from a high level.

Figure 1 shows a typical view of all the major features AppFabric provides, enhances, or otherwise pulls together to provide a complete middle-tier solution for your services.

AppFabric is built to run on Windows 7, Windows Server 2008 R2, and Server 2008. (While not shown in the diagram due to space constraints, it also supports Windows Vista SP1). It only works with these OSs because AppFabric utilizes IIS 7.x and WAS, plus the .NET Framework 4 as its foundation. Simply put, AppFabric is designed to manage and host your code-based WCF services as well as your WCF Workflow Services, and its architecture reflects this.

Hosting and Persistence

AppFabric provides a standard place to put your services, removing the significant burden of writing your own self-hosting code for your WCF services. Out of the box, AppFabric gives you the ability to host your SVC (for code-based WCF Services) or XAMLX (workflow service) services easily in IIS, thereby taking advantage of WAS to use the http, tcp, net.pipe, and MSMQ protocols for your services.

It goes beyond simple hosting for workflow services. AppFabric enables resiliency through a combination of new features that include the Workflow Management Service and the Instance Restart feature. These take advantage of the persistence infrastructure for storing the state of long running workflow service instances in a durable store, such as SQL Server. The Workflow Management Service communicates with each service via an Instance Control Endpoint (ICE) through which it is able to issue commands (such as instructing an instance to resume, suspend, or terminate). The Instance Restart feature relies on the Workflow Management service to monitor all of the hosts managed by AppFabric. If it detects that one of them has failed, it picks up these “orphaned instances” that the host was executing and, using the Instance Control Endpoint, schedules their execution on a different host, resuming them from the last point at which the instance was successfully persisted.

Because AppFabric encourages multiple hosts (and plays nicely in a Web Farm), it also includes sophisticated mechanisms for managing locks on the persisted instances that ensure only one host at a time can own the instance, but at the same time allows for the detection and re-assignment of orphaned instances. In addition, AppFabric automatically provides a configurable retry mechanism for hosts attempting to run an instance owned by another host. With this Lock Retry feature, they don’t fail on the first few attempts from the host attempting to execute the instance. This softening of what would otherwise be a hard failure increases your ability to scale by reducing the contention that would otherwise appear between the hosts, and eliminates the need to implement your own retry mechanism.

AppFabric also provides a hosting feature that primarily enhances code-based WCF services (albeit it could be applied to workflow services). If you have a service that takes a long time to start up, for example because it is loading a large data set into memory or is establishing connections to other systems, it is likely that the client making the first call will, in the best case, experience the delay as slow performance or, in the worst case, experience a timeout. The Auto-Start feature of AppFabric mitigates this by allowing your services to opt in to starting when IIS starts instead of waiting for the first message to activate.

Monitoring and Caching

Providing a scalable and reliable host for services is a very important component of the middle tier. Equally important is the extent to which it allows visibility into the status of the services it is hosting. AppFabric provides the Event Collector that acquires traces from code-based WCF Services and tracking records from WCF Workflow Services via the high speed Event Tracing for Windows infrastructure and writes them to a centralized monitoring store. These records can then be accessed from the various monitoring interfaces present in IIS Manager (discussed shortly) or queried from the monitoring store directly. Out of the box, monitoring records are written to a SQL Server database. This database has a relatively simple schema that is designed with direct querying in mind. It is important to note that while the monitoring and persistence databases default to using SQL Server 2008 as the store, AppFabric has extensibility points allowing it to utilize any database that is accessible with ADO.NET.

Windows Server AppFabric includes a major feature that is designed to provide an in-memory application cache useful for the management of any type of data, in a highly scalable and highly available fashion.

New Features in IIS Manager

AppFabric address two major pain points of developing WCF Services: troubleshooting and configuration. Without AppFabric, troubleshooting a service typically means enabling the diagnostic trace logs, re-running your test to produce the error, and analyzing the result in SvcTraceViewer. While powerful, this approach was time consuming and difficult to master. With AppFabric, troubleshooting a service now amounts to using new features with IIS Manager that display both summary and detailed monitoring data. AppFabric provides four major user interfaces within IIS Manager that have to do with service monitoring:

  1. The Dashboard, which provides a summary view of WCF Service and Workflow Service activity, warning, and error
  2. The Tracked Instances view, which allows you to view a status listing of workflow services instances
  3. The Persisted Instance view, which provides a status listing of workflow service instances that have been written to the persistence store
  4. The Tracked Events view, which lists all trace events or tracking records gathered from service instances.

These last three views provide a user friendly query editor, allowing you to customize the criteria used to produce the records. The Dashboard, however, provides the easiest way to drill down from the summary view, through the instances that feed that summary item (Tracked or Persisted Instance), and then down to the individual events collected for a given instance (Tracked Events). Figure 2 provides an example of drilling down in this way from the dashboard to diagnose an error within a service. Like many of the new features in IIS Manager, the Dashboard is context sensitive (to the node selected in the connections pane of IIS Manager) and can be accessed to provide summary information at the Server, Website, and Application levels. Figure 2 shows the Dashboard at the Server level, summarizing the state of the 73 services being hosted there.

Configuration of WCF Services was problematic in previous versions because all settings had to either be made directly to the .config file’s XML or via the SvcConfigEditor utility. This was both difficult to learn (due to the large amount of settings and equally varied amount of syntax required) and error prone. AppFabric simplifies the configuration of your WCF services by providing context-sensitive configuration dialogs available at the Server, Website, Application, and Service levels (again depending on what is selected in IIS Manager). It also provides an external wizard to help you configure the monitoring and persistence stores and the distributed cache. Figure 3 shows an example of configuring an Application’s monitoring and service certificate. The many configuration dialogs in AppFabric provide an easy way to learn what features can be configured, but also warn the user when certain configurations may cause problems.

PowerShell cmdlets. AppFabric exposes all of its functionality through a collection of PowerShell cmdlets that let you configure the host settings and monitor the status of persisted instances programmatically and via script. In fact, these cmdlets are used under the covers by IIS Manager features and the AppFabric Configuration Wizard.

Visual Studio. Getting started using AppFabric as a developer is very easy. You’ve probably already used the project templates for WCF code-based services (WCF Service Application) or Workflow Services (WCF Workflow Service Applications). To get either of these projects hosted by AppFabric on your local box is a simple change to your project configuration. You only need to configure them to use the Local IIS and create a virtual directory for them, as can be done by pulling up the project properties, selecting the Web tab, choosing the Use Local IIS Server radio button, and clicking the Create Virtual Directory button (see Figure 4).

If you need to deploy your services to a remote AppFabric server, you can take advantage of the new WebDeploy features built in to Visual Studio to one-click deploy them (provided you have properly installed and enabled WebDeploy). For more details on using WebDeploy from within Visual Studio, see the sidebar at the end of this article.

Server Manager. Because it’s expected that the IT pro would use Server Manager as the entry point to managing an AppFabric server, the installation of AppFabric adds a Windows Server AppFabric node underneath Roles\Application Server. This feature provides convenience links that will open IIS Manager or an instance of PowerShell preloaded with the Application Server cmdlets.

Get Started With AppFabric

Given that AppFabric has no licensing cost (it's “free” with your copy of Windows 7 or Windows Vista with SP1 for development use and supported in production with your license of Windows Server 2008 or Windows Server 2008 R2), you should at least kick the tires and find out just how much easier it makes managing your services. The AppFabric installer is a small download that’s smaller than 5 MB and installs in fewer than 10 minutes. See the Additional Resources sidebar for a link to get started.

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish