I struggled today to find a good “Getting started with Windows Server AppFabric Cache” tutorial – either my search fu failed me or it simply doesn’t exist. Nevertheless, I was able to piece together the information I needed to get started.
I recommend you break this up into three steps:
- Installing Windows Server AppFabric
- Configuring Windows Server AppFabric Cache
- Testing Windows Server AppFabric Cache with Sample Apps
I think this article will serve as a good tutorial on getting started, and we can refer back to it as the basis for more advanced scenarios.
Installing Windows Serve AppFabric
- Get the Web Platform Installer.
- Once it is installed and opened, select Options.
- Under Display additional scenarios select Enterprise.
- Now you’ll see an Enterprise tab. Select it, and choose Windows Server AppFabric. Click Install. This will start a multi-step process for installing Windows Server AppFabric (which in my case required two reboots to complete).
Configuring Windows Server AppFabric Cache
- Open the Windows Server AppFabric Configuration Wizard (Start –> Windows Server AppFabric –> Configure AppFabric).
- Click Next until you reach the Caching Service step. Check Set Caching Service configuration, select SQL Server AppFabric Caching Service Configuration Store Provider for the configuration provider, and click Configure.
- Check Create AppFabric Caching Service configuration database, confirm the Server name, and specify a Database name. Click OK.
- When asked if you want to continue, click Yes.
- You will receive confirmation that your database was created and registered.
- On the Cache Node step, confirm the selected port nodes.
- You will be asked to continue and apply the configuration settings; select Yes.
- On the last step you’ll click Finish.
- Open up an elevated Windows PowerShell window.
- Add the Distributed Cache administration module
- Set the context of your Windows PowerShell session to the desired cache cluster with Use-CacheCluster. You can run this without parameters to use the connection parameters provided during configuration.
- Grant your user account access to the cache cluster as a client. Specify your user and domain name.
- Verify your user account has been granted access.
- Start the cluster.
Testing Windows Server AppFabric Cache with Sample Apps
- Grab a copy of the Microsoft AppFabric Samples, which are a series of very short examples.
- Extract the samples locally.
- Open up CacheSampleWebApp.sln (..SamplesCacheCacheSampleWebApp).
- Right-click the CreateOrder.aspx file and select Set As Start Page.
- Hit F5 to start the solution.
- Confirm that the cache is functioning by creating a sample order, getting the sample order, and updating the sample order.
Once you accomplish these three steps, you’ll have the basis for building more complex caching solutions.
I hope this helps!