Windows Azureキャッシュを使用してMVC4アプリケーションにセッションを格納しようとしています。私はLinkの手順に従ってアプリケーションを構築しますが、以下のコード行を使用してDataCacheのオブジェクトを作成しようとすると、'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment'の型初期化器が例外をスローしました
DataCache cache = new DataCache("default");
エラーが発生します。
が見つからないMicrosoft.WindowsAzure.ServiceRuntime.dllまたはバージョン が一致し、私は2.0.0に私のWindows Azureのエミュレータのバージョンを更新し、 がWindowsAzure.Cachingパッケージのバージョン2.0をインストールします.0.0 NuGet パッケージインストーラを使用します。今度はエラーが「 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment'の型初期化子が 例外をスローしました。
誰もがこの上で私を助けることができる場合、私は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 obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Microsoft.ApplicationServer.Caching.DataCacheFactoryConfiguration.Initialize(String clientName)
at Microsoft.ApplicationServer.Caching.DataCacheFactoryConfiguration..ctor()
at Microsoft.ApplicationServer.Caching.DataCacheFactory..ctor()
at Microsoft.ApplicationServer.Caching.DataCacheFactory.InitializeOrFetchSingletonFactoryInstance(String clientConfigurationName)
at Microsoft.ApplicationServer.Caching.DataCache..ctor(String cacheName, String clientConfigurationName)
at Microsoft.ApplicationServer.Caching.DataCache..ctor(String cacheName)
at MvcWebRole.Controllers.HomeController.Index() in d:\Pankaj\Azure.Test\Caching.Sample\MvcWebRole\Controllers\HomeController.cs:line 15
at lambda_method(Closure , ControllerBase , Object[])
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
を参照するようにweb.configファイルとはapp.configエントリを更新する必要がありました。また
のInnerExceptionを含む*フル*例外を投稿してください。 –
例外:呼び出しの対象によって例外がスローされました。 内部例外:{'' Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment 'の型初期化子が例外をスローしました。} – user2384784
実際には* * *以上の情報はありませんか?スタックトレースはありませんか? –