Tag: azure caching

实现azure colocated缓存

使用VS2012,我在WebRole属性缓存选项卡中添加了缓存function。 其中,它在web.config中生成以下XML: <!– –> 好,太棒了。 我将[cluster role name]替换为webrole的名称,例如“helloworld.web”。 现在,当我创建DataCacheFactory或DataCache对象时: _dataCacheFactory = new DataCacheFactory(); _defaultCache = _dataCacheFactory.GetDefaultCache(); //Or, just this line _defaultCache = new DataCache(@”default”); 我收到以下错误: Microsoft.ApplicationServer.Caching.DataCacheException was unhandled HelpLink=http://go.microsoft.com/fwlink/?LinkId=164049 HResult=-2146233088 Message=ErrorCode:SubStatus:Server collection cannot be empty. Source=Microsoft.ApplicationServer.Caching.Client ErrorCode=21 SubStatus=-1 Some notes: IDE: VS2012, Framework: 4.0 AzureSDK: June2012 Local dev machine 我错过了什么? 编辑 我得到了它的工作! 我在WebRole OnStart方法中创建了DataCacheFactory,我把它移到了Global.asax中的Application_Start,它似乎正在工作。 Sandrino解释了为什么会出现这种情况: […]

‘Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment’的类型初始值设定项引发exception

我正在尝试使用Windows Azure缓存在MVC4应用程序中存储会话。 我按照Link的步骤构建了一个应用程序,但是当我尝试使用下面的代码行创建DataCache的对象时。 DataCache cache = new DataCache(“default”); 发生错误: 找不到Microsoft.WindowsAzure.ServiceRuntime.dll或版本不匹配,我将Windows Azure Emulator版本更新为2.0.0并使用NuGet软件包安装程序安装WindowsAzure.Caching软件包版本2.0.0.0。 现在错误更改为“Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment的类型初始化程序”引发exception。 我使用Windows 8 with VS2012 and Windows Azure Emulator version 2.0.0. 如果有人能帮助我,我将不胜感激。 InnerException Message: The type initializer for ‘Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment’ threw an exception. Source: Microsoft.WindowsAzure.ServiceRuntime Stack Trace: at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.get_IsAvailable() at Microsoft.ApplicationServer.Caching.AzureClientHelper.RoleUtility.IsAzureEnvironmentAvailable() Stack Trace: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object […]