AppFabric Tutorial

Most of us know that for web application using OutProc session (where session is stored in SQL or State Server), application state or session can be shared in load balanced scenario. But do you know how to share the cache in load balance or distributed environment. Well with http cache it is not possible because in HttpContext Cache is stored on same server. To resolve this problem Microsoft came up new approach called Windows Server AppFabric Caching.

Windows Server AppFabric provides distributed caching features. With AppFabric you can Cache outgoing WCF service responses. If the response message is in the cache, the custom channel immediately returns the response message from the cache without invoking the underlying service.Secondly Caching specific objects in the Business Layer for frequently access data can improve performance and reduced network overhead.

In this Tutorial we will discuss.

  1. Installing and configuring the AppFabric.
  2. View the cache configuration settings.
  3. How to implement AppFabric Cache in Code.

1. Installing and configuring the AppFabric- For installation refer to MSDN.

After Installing You can start and stop it using below commands.

2. View the cache configuration settings -To view the current settings for the cache, use the Get-CacheConfig command.

Get-CacheConfig appFabricCache
the Get-CacheConfig command prints the cache configuration settings for Cache1 in Command prompt

3. How to implement AppFabric Cache in Code

Step a. Add reference for below dlls from AppFabric Installation Folder or Copy them local bin refer from there.

Step b. Next Create a class as shown below. You can set Cache Configuration as per your needs.

Step 3. Now get/set cache objects as shown below.

Tagged with: , , , , ,
Posted in AppFabric, Blog

Leave a Reply

Punjabi Funda
We have moved our Punjabi Portal to New Domain. Please Visit us at for more details.
Subscribe via Email

Enter your email address to subscribe and receive notifications of new posts by email.

Read previous post:
Build IVR in MVC C#.NET

How to Build IVR (VXML Application) in C#.NET MVC? An IVR (Interactive Voice Response) Application is a modern cost effective...