Programmatically configure Azure cache client

我是研究僧i 提交于 2019-12-10 16:48:52

问题


I just updated via nuGet to the latest Azure dll's (Id: Microsoft.WindowsAzure.Caching version 2.0.0.0, runtime version v4). That allowed me to configure a shared cache for my roles.

The problem is when I try to access to the AppFabric Memcache programmatically (another cache, not related to the session).

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();

The code compiles fine but throws a runtime error:

Method not found: 'Void Microsoft.ApplicationServer.Caching.DataCacheSecurity..ctor(System.Security.SecureString)'.

If I take this code and I put the dll's to runtime version 2 works like a champ.

Any idea what should I change in order to make it work?

Edit:

Looks like the old constructor for DataCacheSecurity doesn't allow the secure token any more

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

Now I just have 2 constructors and looks impossible to specify the auth key

Edit2:

I reached Microsoft and they told me:

“Windows Azure Caching and Windows Azure Shared Caching share the same API, and although the assembly names are the same, the assemblies themselves are different and are in different locations. The Caching NuGet package will remove the Shared Caching assembly references and add the correct Caching assembly references. The Caching assemblies are located in the C:\Program Files\Microsoft SDKs\Windows Azure.NET SDK\2012-10\ref\Caching folder.”

conclusion: it is not possible at the moment.


回答1:


At this time, the new Azure cache .DLL's (v2) are not compatible with previous versions. You will want to choose one version and make sure that all of your providers comply with it. Obviously, the Dedicated cache needs v2.0 of DataCache DLLs.



来源:https://stackoverflow.com/questions/16813664/programmatically-configure-azure-cache-client

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!