Over a million developers have joined DZone.

Making Windows Azure Caching Work in Compute Emulator

DZone's Guide to

Making Windows Azure Caching Work in Compute Emulator

· Cloud Zone ·
Free Resource

Learn how to migrate and modernize stateless applications and run them in a Kubernetes cluster.

Recently I was working on a project where we wanted to use In-Role Windows Azure Caching. We ran into a number of issues while making it work. In this blog post, I will share that experience with you. 

Shorter Version (Tl;DR)

Two things you need to keep in mind:

  1. If the caching is not working at all, see if you’re using Windows Azure Caching package If that’s the case, make sure you’re using Windows Azure SDK Version 2.1.
  2. If the caching is working intermittently, it's time to update your copy of Visual Studio to the latest version. At of the time of writing this blog, “Update 3” of Visual Studio 2012 was the most latest version.

Longer Version

Now for my (in)famous longer version of the blog post. Smile

Problem 1: Caching Just Won’t Work

For our project we started implementing Windows Azure Caching. We went through the guides available on the Windows Azure website and based on that we built a small prototype. The code to initialize the cache was really simple:

cache = new DataCache(nameOfCache);

When we ran the application, it just didn’t work. All we got was a “no such host is known” error. Interestingly, one of my team members had another application that used cache and that worked flawlessly. We were completely baffled. The same piece of code worked in one cloud project but didn’t work in the other. He and another colleague of mine looked deeply and found that the project that worked was using Windows Azure Caching library while the version of the library that didn’t work was using Windows Azure Caching library We were using Windows Azure SDK version 2.0. They then looked at the package description on Nuget and found that version will only work with SDK version 2.1.


More information about this can be found on these threads on StackOverflow:

So we downgraded the Windows Azure Caching library to version and our caching started working properly. So far so good!

Problem 2: Caching Worked Intermittently

This was a really ridiculous problem Smile. We wrote some code and when my colleague ran the code, it worked perfectly fine on his computer. However, when I ran the same code on my computer it ran for a little bit and then caching started throwing all kinds of exceptions. Some of the errors I encountered were:

iisexpress.exe Information: 0 : INFORMATION: <DistributedCache.ClientChannel.;> SocketException
errorcode:10060 message System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed because connected host has failed to respond at System.Net.Sockets.Socket.EndReceive
(IAsyncResult asyncResult) at Microsoft.ApplicationServer.Caching.TcpSocketChannel.AsyncReceiveCallback(IAsyncResult result)

iisexpress.exe Information: 0 : INFORMATION: <DistributedCache.ClientChannel.;> Aborting channel; iisexpress.exe Warning: 0 : WARNING: <SimpleSendReceiveModule> DeadServerCallback Called, Server URI:
[net.tcp://], Underlying exception - 

I searched all over the Internet and found that there were a number of folks who were facing a similar kind of problem. However, none of them found a solution to the problem.

I then approached the Windows Azure Caching team and they have been extremely helpful. They worked diligently with me on getting this issue resolved. We went back and forth but nothing was coming out of it. All the while the code continued to work on my colleague’s machine. This made me realize that there is something wrong with my machine. We compared both machines and found that both of us were running different versions of Visual Studio 2012 and Windows 8. Since we were not getting anywhere, I decided to repave my machine.

So I had Windows 8 Enterprise Edition and Visual Studio 2012 Premium Edition and my colleague had Windows 8 Pro and Visual Studio 2012 Ultimate. I decided to repave my machine the same as my colleague's in the hopes that things might work. I spent about a couple of hours and got everything installed. I then ran the application and still got the same result Sad smile. Then I realized my colleague had “Update 3” of Visual Studio 2012 applied as well, which I hadn't. So I thought what the hell, let’s try that as well.

Guess what? Once I updated Visual Studio to the latest update, magically things started working Smile. I know, I know … it’s a lame solution but, hey, it worked for me. You may want to try that.


To summarize, if caching doesn’t work at all, check to see if the caching library and SDK versions are mismatched. If caching works intermittently, consider upgrading your copy of Visual Studio to the latest version. The last few days have been quite frustrating and unproductive and if you’re facing similar problems I hope that one of these solutions works for you and you don’t have to go through the same ordeal that I did.

Hope this helps.

Join us in exploring application and infrastructure changes required for running scalable, observable, and portable apps on Kubernetes.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}