繁体   English   中英

以编程方式配置Azure缓存客户端

[英]Programmatically configure Azure cache client

我刚刚通过nuGet更新到了最新的Azure dll(ID:Microsoft.WindowsAzure.Caching版本2.0.0.0,运行时版本v4)。 这使我能够为自己的角色配置共享缓存。

问题是当我尝试以编程方式访问AppFabric Memcache(另一个与会话无关的缓存)时。

var servers = new List<DataCacheServerEndpoint>();
servers.Add(new DataCacheServerEndpoint(_hostname, _cacheport));
var conf = new DataCacheFactoryConfiguration();
conf.SecurityProperties = new DataCacheSecurity(secure(_authinfo));
var dataCacheFactory = new DataCacheFactory(conf);
_dataCache = dataCacheFactory.GetDefaultCache();

代码可以正常编译,但是会引发运行时错误:

找不到方法:“无效Microsoft.ApplicationServer.Caching.DataCacheSecurity..ctor(System.Security.SecureString)”。

如果我使用此代码,然后将dll放入运行时版本2,则将获得冠军。

知道要改变它才能使它起作用吗?

编辑:

看起来DataCacheSecurity的旧构造函数不再允许安全令牌

http://msdn.microsoft.com/zh-cn/library/microsoft.applicationserver.caching.datacachesecurity.datacachesecurity(v=ws.10).aspx

现在我只有2个构造函数,看起来无法指定auth密钥

编辑2:

我到达了微软,他们告诉我:

“ Windows Azure缓存和Windows Azure共享缓存共享相同的API,尽管程序集名称相同,但程序集本身不同,并且位于不同的位置。 Caching NuGet软件包将删除Shared Caching程序集引用,并添加正确的Caching程序集引用。 缓存程序集位于C:\\ Program Files \\ Microsoft SDKs \\ Windows Azure.NET SDK \\ 2012-10 \\ ref \\ Caching文件夹中。”

结论:目前尚不可能。

目前,新的Azure缓存.DLL(v2)与以前的版本不兼容。 您将要选择一个版本,并确保所有提供商都遵守该版本。 显然,专用缓存需要v2.0的DataCache DLL。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM