Search code examples
c#azureazure-storageazure-web-rolesazure-caching

Azure Caching System.Runtime.InteropServices.SEHException


I followed the Getting Started with Windows Azure Caching and I keep getting System.Runtime.InteropServices.SEHException: External component has thrown an exception on the line:

var myCache = new DataCache("default");

I've got the WindowsAzure1 project set as startup project. I'm trying to access the cache from an MVC API Project while running in debug, but it keeps erroring out. Does anyone know what I might be doing wrong? Thanks.


Solution

  • I just had exactly the same error except it was happening on App startup rather than on hitting a specific command. After a number of hours and doing many different tutorials I finally traced it to the fact that my project was no longer running in the emulator.

    ie. For Caching (including session state using the cache) in Azure Projects you must debug in the emulator. For me I was hitting f5 on the cloud project. For some odd reason this stopped working.
    To fix under the solution properties -> Common properties -> startup. Select "single startup project" - select your Azure Cloud project.
    Then hit f5 on your azure project to start.

    This fixed for us. We actually got a new error error that the [cache cluster role name] was not found in the deployment. Once I saw this error it was an easy fix by replacing [cache cluster role name] with our Cache Worker role name.