www.it-ebooks.info Microsoft Windows Server AppFabric Cookbook 60 recipes for getting the most out of WCF and WF services, including the latest capabilities in AppFabric 1.1 for Windows Server Hammad Rajjoub Rick G. Garibay P U B L I S H I N G professional expertise distilled BIRMINGHAM - MUMBAI www.it-ebooks.info Microsoft Windows Server AppFabric Cookbook Copyright © 2012 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: July 2012 Production Reference: 1190712 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-84968-418-7 www.packtpub.com Cover Image by Artie Ng (artherng@yahoo.com.au) www.it-ebooks.info Credits Authors Hammad Rajjoub Rick G. Garibay Reviewers Adnan Masood Zubair Ahmed Alvin Lau Acquisition Editors Sarah Cullington Kerry George Lead Technical Editor Azharuddin Sheikh Technical Editors Joyslita D'Souza Unnati Shah Project Coordinator Joel Goveya Proofreader Aaron Nash Indexer Hemangini Bari Graphics Valentine D'silva Manu Joseph Production Coordinator Nilesh R. Mohite Cover Work Nilesh R. Mohite www.it-ebooks.info www.it-ebooks.info Foreword Have you ever set foot in the kitchen with a certain hunger and found that you had no clue as to how to make that dish? At such a time a cookbook is a wonderful thing. That's why I appreciate this concept of a cookbook for workows and services. At Microsoft when we build products they are often chocked full of little known but wonderful capabilities and guys like Hammad and Rick are just the sort of chefs that have what it takes to make you successful with it. AppFabric brings some terric capabilities to Windows Server and IIS with distributed caching and terric hosting features for WCF Services and WCF Workow Services at no additional cost, so using it is a no-brainer but maximizing it will take the kind of insight you will nd in this book. So break out the mixing bowls, spatulas, and turn on the oven… I can almost smell success from here. Ron Jacobs Senior Program Manager, Microsoft Corporation www.it-ebooks.info About the Authors Hammad Rajjoub works as an Architect Evangelist with Microsoft. Before joining Microsoft, he was awarded Microsoft's Most Valuable Professional award, seven years in a row. Along with being an MVP he was also a Microsoft Business Platform Technology Advisor. Being an MVP in Connected Systems gave him early access to Windows Communication Foundation, Windows Workow Foundation, as well as Windows Server AppFabric. In his previous roles he has been a CTO at a technology startup, Vice President at one of the largest nancial institutions, as well as a Solutions Architect at a leading consulting company. He has over a decade of experience using Microsoft Technologies, especially .NET since its beta 1 release. He is a published author and a frequent speaker at technology conferences (including TechEd and Cloud Computing Asia). He has founded a number of developer and architect communities over the years and remains a passionate speaker and contributor at local technical communities in Singapore. He is also an active member of the International Association of Software Architects (IASA) - Singapore Chapter. His areas of interest include Cloud Computing, Enterprise Architecture, Design Patterns, and Quantum Computation. At home he is a busy husband and father of twin girls and a baby boy. For more details visit his website at http://www.hammadrajjoub.net or on twitter: @hammadrajjoub. Alhamdulillah - This work would not have been possible without the help and support from my family. Special thanks to my mother Noor and my wife Iman for being supportive and giving me time and help to complete this book. I would also like to express my gratitude to my friend and co-author of this book, Rick Garibay, for accepting my invitation to co-author this book and sharing his feedback throughout the lifecycle of this book. Also, special thanks to Adnan Masood, Zubair Ahmed, and Alvin Lau for technically reviewing the book, providing feedback, and correcting numerous mistakes. Last but not the least, thanks to the editorial and project team at Packt Publishing for giving me the opportunity to write this book, and also being patient and understanding through the process of writes, re-writes, technical edits, as well as cases of missed deadlines. www.it-ebooks.info Rick G. Garibay is a developer, architect, speaker, and author on distributed technologies and is the General Manager of the national Connected Systems Practice at Neudesic. With over 13 years' experience delivering distributed solutions across industry sectors such as nance, transportation, hospitality, and gaming, he specializes in distributed technologies such as Microsoft .NET, Windows Communication Foundation, Workow Foundation, and Windows Azure to help his clients deliver business value and drive revenue while reducing operational costs. As a ve-time Microsoft Connected Systems MVP, he is an active speaker, writer, and passionate community advocate and is the Co-Founder of the Phoenix Connected Systems User Group (pcsug.org), celebrating four years in operation. He serves as an advisor to Microsoft in a number of roles as a member of the Microsoft Application Platform Partner Advisory Council and long-time member of the Business Platform Advisors and Azure Technology Advisors groups. Recent presentations include talks at the Microsoft SOA and Business Process Conference, Microsoft TechEd, Dev Connections, .NET Rocks, Desert Code Camp, and numerous Microsoft events and user groups throughout North America. He is a frequent contributor to industry publications such as CODE Magazine and maintains a blog at http://rickgaribay.net. You can catch up with Rick on Twitter @rickggaribay. I would like to thank my loving, patient, and amazing wife Christie for being my rock and providing a foundation which has allowed us to grow a beautiful family while enduring the sometimes overbearing demands of my career. I'm also grateful to my wonderful children, Sarah and Ricky for tolerating the many lost nights and weekends holed up in my home ofce working on this book. I would also like to thank Mickey Williams, VP Technology Platform Group at Neudesic for his support in taking on this project along with his words of encouragement and (always timely) sense of humor along the way. Last but not least, I would like to thank my friend and co-author, Hammad Rajjoub for inviting me to participate in this project and trusting me to help carry out his vision for this book. Hammad and I both share a labor of love as it applies to the Microsoft distributed technology stack affectionately (and somewhat nostalgically) known as "Connected Systems" and this book is both a reection and an acknowledgment of the tremendous work the WCF, WF, and Dublin teams have done in putting these tremendous capabilities within reach of developers tasked with solving tough distributed challenges today. www.it-ebooks.info About the Reviewers Adnan Masood is a Software Engineer and Architect with zeal for solving interesting algorithmic, business, and technology problems. With special interest in scalable architectures, algorithm design, application security, and software development, he has over a decade of hands-on experience in nancial services and application service providers. He currently works as a System Architect for Green Dot Corporation, a leading pre-paid nancial institution where he develops robust, scalable, and secure SOA based middle-tier architectures, distributed systems, and web applications. He is a Microsoft Certied Trainer and holds various technical certications including MCPD (Enterprise Developer), MCSD .NET, and SCJP-II. He is attributed and published in print media and on the Web; he also taught Windows Communication Foundation (WCF) courses at the University of California, San Diego. He regularly presents at local code camps and user groups. He is actively involved in the .NET community as Co-founder and President of the of San Gabriel Valley .NET Developers group and recipient of the INETA Community Champion Award for contributions to the developer community in Southern California. He holds a Master's degree in Computer Science and is currently pursuing a doctorate in Machine Learning; specically interestingness measures in outliers using belief networks. He also holds systems architecture certication from MIT and SOA Migration, Adoption, and Reuse Technique certicate from SEI, Carnegie Melon University. He can be reached at adnan@nova.edu. Alhamdullilah - Thanks to my family for their constant support during the process of editing this book. I would also like to thank Hammad for the opportunity and both Hammad and Rick for putting up with my feedback and tech edits. Last but not least, thank you Joel for your great project coordination skills. www.it-ebooks.info Zubair Ahmed is an experienced software developer, blogger, and technical presenter. His interests include software architecture, improving code quality, and keeping an eye on the latest technologies. He works as a Software Consultant for Infusion Development in Dubai. When he is not working he likes to spend time in front of his large monitor at home writing some code, go for long drives with his wife, or socialize with friends. His technical blog is at zubairahmed.net and his tweet handle is @zubairdotnet. For technology updates, subscribe to his Facebook page at http://facebook.com/zubair.ahmed.public. www.it-ebooks.info [...]... Installing Windows Server AppFabric Introduction Installing Windows Server AppFabric Configuring Windows Server AppFabric (hosting and monitoring) Configuring Windows Server AppFabric (caching) Installing Cache Client Assemblies Changing the Windows Server AppFabric configuration after installation Starting a Caching service Troubleshooting Windows Server AppFabric – configuration errors Troubleshooting Windows. .. 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. .. Installing Windows Server AppFabric In this chapter, we will cover: ff Installing Windows Server AppFabric ff Configuring Windows Server AppFabric (hosting and monitoring) ff Configuring Windows Server AppFabric (caching) ff Installing caching Client Assemblies ff Changing the Windows Server AppFabric configuration after installation ff Starting a Caching service ff Troubleshooting Windows Server AppFabric. .. Windows Server AppFabric can be changed after the installation Lastly, at the end of the chapter, we will see how to troubleshoot some common problems with Windows Server AppFabric installations Installing Windows Server AppFabric Windows Server AppFabric is an extension of the Application Server role on the Windows platform At the time of this writing there are two ways to install Windows Server AppFabric. .. Troubleshooting Windows Server AppFabric – auto restart issues Introduction Windows Server AppFabric is an extension of the Application server role on the Microsoft Platform Windows Server AppFabric offers in-memory, super-fast, scalable caching capabilities for web applications and services For applications built using Windows Communication Foundation (WCF) and Workflow Foundation (WF), Windows Server AppFabric. .. with Windows Server AppFabric However, it is recommended that you have at least 4 GB of RAM to run Windows Server AppFabric If you want to try Windows Server AppFabric before actually installing it on your host machine, it makes sense to use a virtual machine that has Windows Server AppFabric installed on it so that you can play with it The good news is that Microsoft has made a preconfigured Windows Server. .. stores Securing Windows Server AppFabric' s monitoring store Securing the Event Collection service 337 340 347 361 363 367 373 375 378 383 390 iii www.it-ebooks.info www.it-ebooks.info 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... Configuring Windows Server AppFabric (hosting and monitoring) There are a number of configuration options available when configuring Windows Server AppFabric, and in this recipe we will go through them At this point, we should appreciate Microsoft' s efforts in designing Windows Server AppFabric, as it allows a fair bit of customization Getting ready Configuring Windows Server AppFabric is available via the Windows. .. host machine 11 www.it-ebooks.info Installing Windows Server AppFabric 8 Once all the required software components are installed, the Windows Server AppFabric installation will be complete Click on Finish: How it works The Windows Server AppFabric installation adds three new Windows services: AppFabric Caching Service, AppFabric Event Collection Service, and AppFabric Workflow Management Service, for... Management Service, and Windows Server AppFabric Caching Service form the heart of Windows Server AppFabric These services work in the background and perform tasks such as collecting events, managing the workflow's life cycle, connecting to the cache cluster, and serving cache related requests Once Windows Server AppFabric is installed, the next step is to configure it using the Windows Server AppFabric Configuration . 1 Chapter 1: Installing Windows Server AppFabric 7 Introduction 7 Installing Windows Server AppFabric 8 Conguring Windows Server AppFabric (hosting and. 401 www.it-ebooks.info www.it-ebooks.info Preface Windows Server AppFabric is an extension of the Application Server Role on the Windows Server Platform. In a nutshell, Windows Server AppFabric