Book Image

Microsoft Windows Server AppFabric Cookbook

Book Image

Microsoft Windows Server AppFabric Cookbook

Overview of this book

Windows Server AppFabric provides a set of integrated capabilities that extend IIS and the Windows Server platform making it easier to build, scale and manage composite applications today. Windows Server AppFabric delivers the first wave of innovation within an exciting new middleware paradigm which brings performance, scalability and enhanced management capabilities to the platform for applications built on the .NET Framework using Windows Communication Foundation and Windows Workflow Foundation.'Microsoft Windows Server AppFabric Cookbook' shows you how to get the most from WCF and WF services using Windows Server AppFabric leveraging the capabilities for building composite solutions on the .NET platform. Packed with over 60 task-based and immediately reusable recipes, 'Microsoft Windows Server AppFabric Cookbook' starts by showing you how to set up your development environment to start using Windows Server AppFabric quickly. The book then moves on to provide comprehensive coverage of the most important capabilities provided by Windows Server AppFabric, diving right in to hands-on topics such as deploying WCF and WF applications to Windows Server AppFabric and leveraging the distributed caching, scalable hosting, persistence, monitoring and management capabilities that Windows Server AppFabric has to offer, with recipes covering a full spectrum of complexity from simple to intermediate and advanced.
Table of Contents (16 chapters)
Microsoft Windows Server AppFabric Cookbook
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface

Starting a Caching service


Windows PowerShell plays an extremely important role in the overall management of Windows Server AppFabric. There are hundreds of cmdlets and functions available that allow administrators (and developers alike) to perform day-to-day management tasks on AppFabric. As Caching is one of the biggest features in Windows Server AppFabric, it is no surprise that AppFabric Caching has a dedicated set of PowerShell cmdlets that allow developers and administrators to interact with the distributed Cache environments in an interactive and streamlined manner.

In this recipe, we will look at how to use PowerShell cmdlets to interact with the AppFabric Caching service.

Note

There are two ways that you can configure your Windows Server AppFabric installation/environment. One option is to use the Windows Server AppFabric Configuration wizard (that we have extensively used in this chapter) and another option is to use the Windows Server AppFabric PowerShell cmdlets. Using PowerShell to manage AppFabric Caching introduces a number of useful possibilities, including but not limited to automating build and deployment scenarios, and enabling command line monitoring and troubleshooting.

Getting ready

Assuming that you have the Windows Server AppFabric administration feature installed, you can launch the AppFabric PowerShell console via Administrative tools (available under Start | Control Panel | Administrative Tools) or by going to the Windows Server AppFabric folder under Program Files and selecting Caching Administration Windows PowerShell:

Note

On Windows 7 and Windows Server 2008, you must run Caching Administration Windows PowerShell with administrative privileges, otherwise some commands will not work.

How to do it...

After starting the Caching Administration Windows Powershell console with administrative privileges, we can start our Cache Cluster for the first time:

  1. 1. To set the context of the Windows PowerShell session, we will execute the use-CacheCluster command first.

    Note

    The Use-CacheCluster command sets the context for Windows PowerShell. Considering that this is being executed on the host computer, we do not need to provide the configuration, as the parameters are extracted from the local computer.

  2. 2. Once the context has been set, we will execute the start-CacheCluster command. This should result in a status that shows that the Caching Service is up and running:

    Note

    The Start-CacheCluster commandlet starts the caching service on all the servers that are part of the cluster with the lead hosts starting before non-lead hosts.

  3. 3. Once the Caching Service is up and running, we can query it for the caches that are available in this cluster by using the Get-Cache command.

    Note

    This shows that the cluster is up and running and there is a default cache instance running on the cluster.

How it works...

The Caching Administration PowerShell commandlets give us complete control for managing an AppFabric Cache Cluster. When starting PowerShell sessions and running on a non-host computer, you must provide the -Provider (xml or System.Data.SqlClient) and ConnectionString (file path for XML or connection string for database).

Note that Cache services do not automatically start after a system reboot, so the Start-CacheCluster command must be invoked. We can also use the Start-CacheHost command with HostName and Port parameters to start a particular host in the cluster.

We will see much more on each of these PowerShell commands in the following chapters of this book.