I had a few issues getting AppFabric setup to handle my ASP.NET session state. Here is a quick rundown of what it took. This was a single AppFabric server (Windows Server 2008 R2) in a work group, not on a domain.
- On your app fabric server, make a new local account called “AppFabric”
- Create a file share named AppFabric that gives the AppFabric user full control
- Install AppFabric, set the run as user to AppFabric
- Select the XML config provider and point it to the AppFabric Share
- In the start menu, there will an app fabric folder, with a windows power shell
- Run the power shell as administrator
- run the following command Set-CacheClusterSecurity -SecurityMode None -ProtectionLevel None
- Start your cache using the AppFabric Caching Admin Tool
That is everything on the server side. On the client ASP.NET app, it took a bit of tweaking. Here is my complete web.config file. Also note, that your Client must resolve the host name of the AppFabric server. I had to add an entry to my hosts file.
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 -->
<configuration>
<configSections>
<!-- required to read the <dataCacheClient> element -->
<section name="dataCacheClient"
type="Microsoft.ApplicationServer.Caching.DataCacheClientSection,
Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"
allowLocation="true"
allowDefinition="Everywhere"/>
</configSections>
<dataCacheClient>
<!-- cache host(s) -->
<hosts>
<host
name="ServerName or IP Address"
cachePort="22233"/>
</hosts>
<securityProperties mode="None" protectionLevel="None" />
</dataCacheClient>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<assemblies>
<add assembly="Microsoft.ApplicationServer.Caching.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>
<sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
<providers>
<!-- specify the named cache for session data -->
<add
name="AppFabricCacheSessionStoreProvider"
type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider"
cacheName="Name1" sharedId="SharedApp"
/>
</providers>
</sessionState>
</system.web>
</configuration>