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

Preface

Windows Server AppFabric is an extension of the Application Server Role on the Windows Server Platform. In a nutshell, Windows Server AppFabric frees Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Service developers from common infrastructure plumbing by providing a robust, secure, composable, and reliable platform which provides caching, hosting, and monitoring capabilities, including support for long running workflow services, all on the Windows Platform. As such, Windows Server AppFabric is an evolution of the Windows Server platform, providing essential building blocks for first-classing WCF (for code-based services) and WF (for declarative workflow services) that are built using the .NET Framework 4 and Visual Studio 2010.

As an extension to IIS and WAS, Windows Server AppFabric relies on IIS's proven capabilities for hosting and lifecycle management, adding additional useful capabilities for working with WCF and WF services. In addition, Windows Server AppFabric takes advantage of Windows Server's robust event tracing mechanism (also known as ETW). ETW provides optimized and high-performing kernel-level instrumentation which greatly minimizes impact on the performance of WCF and WF services hosted in IIS with Windows Server AppFabric.

Whether you are a developer who wants to avoid the same repetitive tasks when preparing your WCF and/or WF services for deployment, or an IT Pro who wants to avoid complex XML for configuring hosting and monitoring options for the services you manage, you will instantly benefit from Windows Server AppFabric. Best of all, Microsoft has made this key extension to the Windows Server Platform available free of charge.

Written by both a former MVP and now Architect Evangelist with Microsoft and a five-time Connected Systems Developer MVP, the authors of this book both worked very closely with Microsoft during the development of the product (then codenamed "Dublin") participating in Software Design Reviews and early incubation initiatives. Hammad and Rick have advised customers of all shapes and sizes and fielded these capabilities in countless projects across various verticals in the two years since its general availability.

This book is full of practical, step-by-step guidance including useful tips and techniques that will allow you to build scalable, reliable, and secure service-oriented applications on the Windows Server Platform with IIS and Windows Server AppFabric.

What this book covers

Chapter 1, Installing Windows Server AppFabric, covers setting up your development environment to use Windows Server AppFabric. You'll learn how to install hosting, persistence and monitoring capabilities, including provisioning repositories, choosing the appropriate storage options, making changes to configuration after installation, and troubleshooting common (and not so common) installation issues you might encounter along the way.

Chapter 2, Getting Started with AppFabric Caching, introduces Caching in Windows Server AppFabric, covering everything you need to get started with introducing this important capability to your composite applications and services. You will learn how to set up and use Caching using code and configuration options, as well as working with Caching within your applications. In addition, you'll learn how easily an existing application that relies on ASP.NET session state can immediately benefit from Windows Server AppFabric Cache, handling common error conditions, using PowerShell commandlets, and building a custom provider model.

Chapter 3, Windows Server AppFabric Caching — Advanced Use Cases, builds on the concepts in the previous chapter, covering the use of Regions and Tags as well as choosing the right concurrency mode and establishing expiration, eviction, and notification policies. You will also learn advanced monitoring concepts including the use of performance counters, configuring high availability, and common troubleshooting techniques for getting the most out of Windows Server AppFabric Cache.

Chapter 4, Windows Server AppFabric Hosting Fundamentals, introduces Windows Server AppFabric's hosting capabilities, covering common deployment, management, and hosting scenarios. You'll learn how to host WCF SOAP and REST services as well as simple WF services along with a number of tips and tricks for moving beyond the service template defaults.

Chapter 5, More Windows Server AppFabric Hosting Features, covers additional hosting topics, including supporting long-running WF services, how your services can benefit from the Auto-Start feature, properly hosting WCF services that take advantage of Windows Azure Service Bus Relay bindings for enabling modern, hybrid scenarios as well as common PowerShell commandlets for scripting many of the tasks covered in this and the previous chapter.

Chapter 6, Utilizing AppFabric Persistence, provides ample coverage of Windows Server AppFabric persistence capabilities, including configuring persistence for WF services, working with multiple persistence stores, and developing instance store, control, and query providers. This chapter also provides an in-depth walkthrough of development and configuration of custom instance, control, and query providers.

Chapter 7, Monitoring Windows Server AppFabric Deployment, provides an introduction to the monitoring capabilities provided by Windows Server AppFabric. Topics include collecting and viewing events from WCF and WF services, enabling tracing and configuring tracking profiles, and leveraging PowerShell cmdlets for monitoring WCF and WF services as well as the Caching service. In addition, you'll learn how to surface monitoring information to any user experience by following the sample recipe for building a custom monitoring dashboard using ASP.NET MVC and OData.

Chapter 8, Scaling AppFabric Hosting, Monitoring, and Persistence, covers a common scenario for scaling Windows Server AppFabric across multiple IIS hosts. You will learn how to prepare two hosts for clustering using Microsoft NLB as well as understand deployment, management, and administration of a multi-host Windows Server AppFabric deployment that shares a common, centralized persistence store.

Chapter 9, Configuring Windows Server AppFabric Security, covers what you need to know about planning and implementing a security model with Windows Server AppFabric. You will learn how to secure the caching, persistence, monitoring, and eventing (via ETW) subsystems of Windows Server AppFabric.

What you need for this book

This book assumes you have a solid foundation in messaging and workflow concepts and are proficient in developing web services with WCF 4.0 and WF 4.0, in addition to C#, the .NET Framework, and Visual Studio 2010. You will need a Windows 7 (or Windows Server 2008/R2) machine configured for IIS 7 along with SQL Server and Visual Studio 2010, as well as either Windows Server AppFabric or Microsoft AppFabric 1.1 for Windows Server.

To take advantage of the latest caching features introduced in AppFabric 1.1, it is recommended that you install Microsoft AppFabric 1.1. for Windows Server. Otherwise, Windows Server AppFabric (the first version of this release) will suffice and is the product name we use throughout this book.

Either version can be installed on Windows 7, Windows Server 2008, Windows Vista R2, or Windows Server 2008 R2 and they support both 32- and 64-bit architectures. You will also need Microsoft .NET Framework v4, IIS7, and Windows PowerShell 2.0. In terms of hardware, officially, any 1GHz+ CPU (900MHz+ for Dual Core and 700MHz+ for Quad Core) with 2 GB of RAM will be sufficient to get up and running. However, it is recommended that you have at least 4 GB of RAM to run Windows Server AppFabric or Microsoft AppFabric 1.1 for Windows Server.

Who this book is for

Whether you are an architect or developer designing and developing composite solutions with WCF and WF services or an IT Pro tasked with their deployment and maintenance; or designing and implementing a distributed caching strategy for your .NET services and applications, this book is for you.

This book does not assume any prior knowledge of Windows Server AppFabric; however, a basic understanding of .NET Framework 4.0, Windows Communication Foundation (WCF), and Windows Workflow Foundation (WF) technologies is required.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "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."

A block of code is set as follows:

internal enum AckNack
{
Ack,
Nack,
Pending,
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<microsoft.applicationServer>
<monitoring>
<default
enabled="true"
connectionStringName="ConnectionString"
monitoringLevel="Troubleshooting" />

</monitoring>
</microsoft.applicationServer>

Any command-line input or output is written as follows:

Get-ASAppMonitoring -SiteName "Default Web Site" -VirtualPath /ReservationService

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "In IIS, click on the application and select Features View."

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book — what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title through the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books — maybe a mistake in the text or the code — we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.