SignalR CryptographicException on AzureWebsites-Collection of common programming errors

This is the single post that allowed my to resolve this same issue using the following code. dfowlers mention of registering an instance of IProtectedData led me to search and find the definition here.

Note this issue was not encountered when using the Visual Studio development server, but when moving to live. I’m glad I found this post, as I have no idea how I would have been supposed to know to implement IProtectedData otherwise. Maybe there’s something deeper in the documentation.

Whether or not this is 100% the correct solution I’m not sure, but this worked for me. I created a class implementing IProtectedData, and then registered that with Ninject.

Class:

using Microsoft.AspNet.SignalR.Infrastructure;

namespace Fwr.DataTeamUploader.Logic
{
    public class ProtectedData : IProtectedData
    {

        // Obviously this isn't doing much to protect the data,
        // assume custom encryption required here

        // To reiterate, no encryption is VERY^4 BAD, see comments.

        public string Protect(string data, string purpose)
        {
            return data;
        }

        public string Unprotect(string protectedValue, string purpose)
        {
            return protectedValue;
        }
    }
}

Ninject registration:

/// 
/// Load your modules or register your services here
/// 
/// The kernel.
private static void RegisterServices(IKernel kernel)
{
    ...

    kernel.Bind().To();

    ...