http://msdn.microsoft.com/en-us/library/windowsazure/gg618003のコードに基づいて概念実証を試みています。app.config 設定を使用すると、このキャッシュにアクセスできます。プログラム構成を使用するようにアプリケーションを切り替えたとき、一貫してこのエラーが発生します。私はすでにAzureキャッシュをプログラムで構成して検証に失敗し、他の多くのソリューションを無駄にしました。
これが私のコードスニペットです。
{コード}
String acsKey = "AcsKey removed intentionaly";
DataCacheFactoryConfiguration cacheFactoryConfiguration;
DataCacheSecurity dataCacheSecurity;
DataCacheServerEndpoint[] serverEndpoints = new DataCacheServerEndpoint[1];
SecureString secureAcsKey = new SecureString();
serverEndpoints[0] = new DataCacheServerEndpoint("EndPont removed intentionaly", 22243);
//
// Create SecureString from string
//
foreach (char keyChar in acsKey)
{
secureAcsKey.AppendChar(keyChar);
}
secureAcsKey.MakeReadOnly();
dataCacheSecurity = new DataCacheSecurity(secureAcsKey);
//
// Initialize Factory Configuration
//
cacheFactoryConfiguration = new DataCacheFactoryConfiguration(); // This line throws exception. Note that the key is yet to be assigned to SecurityProperties as per documentation.
cacheFactoryConfiguration.Servers = serverEndpoints;
cacheFactoryConfiguration.SecurityProperties = dataCacheSecurity;
_cacheFactory = new DataCacheFactory(cacheFactoryConfiguration);
_cache = _cacheFactory.GetDefaultCache();
{コード}