I have gone through some of the exercises in the Visual Studio 2010 and .NET Framework 4 Training Kit (February release) but with .NET 4 and Visual Studio 2010 RC installed (the training kit is really made for beta 2). There are some things that need to be changed in order for the labs to work, mainly in the area of AppFabric cache (formerly known as Velocity). Here is what I had to change.
Introduction to AppFabric Cache – Exercise 2: AppFabric Cache SessionState Provider
I had no “Start | All Programs | Microsoft Distributed Cache | Administration Tool – Microsoft Distributed Cache” on my machine. But this thread pointed me to solution. Start PowerShell from a command prompt by typing PowerShell. Then, type the following commands:
The cache service should now be up an running.
Regarding the web project, name spaces and assemblies have been renamed. So delete the invalid references to CacheBaseLibrary and ClientLibrary, and add references to Microsoft.ApplicationServer.Caching.Client and Microsoft.ApplicationServer.Caching.Core instead. This part is a little tricky. You cannot browse to the folder C:WindowsSystem32AppFabric where these are for some reason. I found the answer here: How to add a reference to Microsoft.ApplicationServer.Caching.Client. You enter the following file name: %windir%SysnativeAppFabric.
The other thing you must do is to change the web.config file. In configSections, you should have
type="Microsoft.ApplicationServer.Caching.DataCacheClientSection, Microsoft.ApplicationServer.Caching.Core, Version=126.96.36.199, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
You don’t need <section name=”fabric” … />
And the dataChacheClient section should look like this:
<!– (optional) specify local cache
<localCache isEnabled="true" sync="TTLBased" objectCount="100000" ttlValue="300" />
<!– cache host(s) –>
<host name="localhost" cachePort="22233"/>
Finally the sessionState element inside system.web:
<sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
<!– specify the named cache for session data –>
type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider, Microsoft.ApplicationServer.Caching.Client, Version=188.8.131.52, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Now, you have to create NamedCache1. Go back to the PowerShell prompt and type:
Introduction to AppFabric Cache – Exercise 3: Microsoft Distributed Cache as an Object Cache
The same web.config changes apply as in exercise 2.