无法在调试中创建 DataCacheFactory 实例

Unable to create DataCacheFactory instance in debug

这是我创建工厂和缓存客户端的代码:

var cacheFactoryConfig = new DataCacheFactoryConfiguration
        {
            ChannelOpenTimeout = TimeSpan.FromMinutes(2),
            TransportProperties = {ReceiveTimeout = TimeSpan.FromSeconds(45)}
        };
        DataCacheFactory cacheFactory;
        try
        {
            cacheFactory = new DataCacheFactory(cacheFactoryConfig);// <--stops here
        }
        catch (Exception e)
        {
            Trace.WriteLine(string.Format("--> Message-> {0}; --> Stack Trace->{1}", e.Message, e.StackTrace));
            throw;
        }
cacheClient = cacheFactory.GetDefaultCache();

服务配置:

在 web.config 中缓存客户端和服务器配置

如果需要,我会提供任何其他信息以便尽快解决问题。

-----编辑 1-----------------

由于相关 post Making Windows Azure Caching Work in Compute Emulator 我必须添加一些信息:

我没有安装 Windows Server AppFabric,所以我要安装它!

经过几天的调查,我设法解决了问题并成功创建了 DataCacheFactory 和 DataCache 等实例。在以下 2 个帖子:

中描述并解决了该问题

https://social.msdn.microsoft.com/Forums/azure/en-US/8580689a-a1a1-4db7-bba9-f42c1a90e0db/windows-azure-webrole-caching-preview-hangs-makes-the-emulator-stuck-in-deploy-loop?forum=windowsazuredevelopment

http://blog.elastacloud.com/2012/06/09/using-the-windows-azure-cache-preview-with-sdk-1-7/

我想指出,windows 事件查看器帮了大忙。在 Windows Azure 日志中,我发现在使用 Azure 模拟器启动 Web 角色时发生错误。 CacheInstaller.exe -> MissingMethodExceprion 抛出错误,消息为:

Method not found: 'Microsoft.ApplicationServer.Caching.ClusterConfigElement