.NET 4 RC and Visual Studio 2010 and .NET Framework 4 Training Kit

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:

Import-Module DistributedCacheAdministration
Import-Module DistributedCacheConfiguration

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

<section name="dataCacheClient"
    type="Microsoft.ApplicationServer.Caching.DataCacheClientSection, Microsoft.ApplicationServer.Caching.Core, Version=, 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=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

Now, you have to create NamedCache1. Go back to the PowerShell prompt and type:

New-Cache NamedCache1

Introduction to AppFabric Cache – Exercise 3: Microsoft Distributed Cache as an Object Cache

The same web.config changes apply as in exercise 2.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.