Architect Ryan

Using Windows AppFabric Caching (Velocity) Beta 2 with .NET 4.0 RTM

📅 April 26, 2010 ⏱ 1 min read

One of the awesome Microsoft tools that I’m fortunate to work with is Windows AppFabric Caching, codenamed Velocity. It’s a distributed caching engine, not unlike MemCache. I think overall it works really great in my application’s usage, and I also love how there is a Session plugin which is great for running under a farm. My project has been using .NET 4.0 since Beta 1, so you could call us early adopters. Last week when Visual Studio 2010 and .NET 4.0 RTMed, my entire team immediately upgraded. Our entire code base worked as-is with no code changes (we upgraded from the .NET 4 RC). The one thing I was surprised about was that the AppFabric Caching service did not start - in fact, it immediately failed. I quickly posted on the MSDN Forums about this, here: http://social.msdn.microsoft.com/Forums/en-US/velocity/thread/681a2283-a735-488a-aeeb-cdbcfd06d58c.

I received a not so awesome reply:

Beta2 works only with RC release of .Net 4/VSTS 2010. You’ll need to wait for the upcoming RC release which will work with .Net4 RTM.

With that said, I went off to figure out if I could make this work, despite Microsoft’s guidance, especially considering our code base upgraded with 0 changes. It turns out there is a simple fix for the issue. All you need to do is edit %windir%\System32\AppFabric\DistributedCacheService.exe.config and make these changes: Replace

<supportedruntime version="v4.0.30128"></supportedruntime>

With:

<supportedruntime version="v4.0.30319"></supportedruntime>

With this one simple change, everything works great! There is one other issue. What if you need to install AppFabric Caching, with .NET 4.0 RTM installed? Well, the answer is, you can’t. You have to uninstall the .NET 4.0 RTM, install the .NET 4.0 RC, install AppFabric Caching, then uninstall the RC, and install the RTM. Yes, this is a huge pain, but since the AppFabric installer is not an MSI, and has a dependency on the .NET 4.0 RC, I can see no other way to get around this. At least it is *possible* to do this!


Ryan Hoffman

Written by Ryan Hoffman, an experienced team leader, certified Scrum Master and software architect.
Contact RyanFollow Ryan on Twitter


The postings on this site are my own and I am not speaking as a representative of my employer, any company or organization.