2013-01-05 3 views
6

Sto cercando di far funzionare Caching sul mio sito Web Windows Azure. La memorizzazione nella cache è configurata su uno dei miei ruoli di lavoro.Problemi nel recupero della cache all'interno dei siti Web di Azure

Ho usato questo articolo per iniziare: http://www.windowsazure.com/en-us/develop/net/how-to-guides/cache/

Inizialmente ho avuto problemi per ottenere la dll client Azure Cache di lavoro a causa di errori di montaggio mancanti.

Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. 
Could not load file or assembly 'msshrtmi, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. 

se sono stato aiutato da questo articolo per risolvere questo: http://www.thedailyparker.com/PermaLink,guid,0be6425e-b509-4122-af01-7086ce2f811e.aspx

Ma la prossima sto ottenendo un SEHException che suona come un problema di configurazione. Anche se non ho idea di cosa mi stia perdendo. Dettagli eccezione:

[SEHException (0x80004005): External component has thrown an exception.] 
    RdGetApplicationConfigurationSetting(UInt16* , UInt16**) +0 
    RoleEnvironmentGetConfigurationSettingValueW(UInt16* pszName, UInt16* pszDest, UInt32 cchDest, UInt32* pcchRequiredDestSize) +47 
    Microsoft.WindowsAzure.ServiceRuntime.Internal.InteropRoleManager.GetConfigurationSetting(String name, String& ret) +91 
    Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(String configurationSettingName) +54 
    Microsoft.ApplicationServer.Caching.AzureCommon.TopologyHelper.TryGetServiceConfigurationSetting(String value, String& result) +40 
    Microsoft.ApplicationServer.Caching.AzureCommon.DiagnosticsUtility.GetDiagnosticLevel(String propertyName) +47 
    Microsoft.ApplicationServer.Caching.AzureCommon.DiagnosticsUtility.GetClientLogLevel() +20 
    Microsoft.ApplicationServer.Caching.AzureClientHelper.RoleUtility.ReadClientLogLevel() +5 
[TargetInvocationException: Exception has been thrown by the target of an invocation.] 
    System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0 
    System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +192 
    System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +108 
    Microsoft.ApplicationServer.Caching.DataCacheFactoryConfiguration.Initialize(String clientName) +205 
    Microsoft.Web.DistributedCache.DataCacheFactoryWrapper.CreateDataCacheFactoryConfiguration(String dataCacheClientName) +77 
    Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider.CreateInternalProvider(IHttpRuntime httpRuntime, OutputCacheInitializationData initData, IDataCacheFactory dataCacheFactory, EventHandler`1 cacheFetching, EventHandler`1 cacheFetched) +28 
    Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider.GetInternalProvider() +148 
    Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider.Get(String key) +11 
    System.Web.Caching.OutputCache.Get(String key) +56 
    System.Web.Caching.OutputCacheModule.OnEnter(Object source, EventArgs eventArgs) +9717054 
    System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69 

spero che qualcuno mi può aiutare nella giusta direzione.

risposta

6

Non è possibile accedere a Caching di Windows Azure da un sito Web. È possibile accedervi solo da un ruolo Web o un ruolo di lavoro.

Hai provato Windows Azure Shared Caching nel tuo sito web? Questo dovrebbe funzionare (non ho mai provato questo in un sito Web).

+0

Grazie Sandrino, Ho provato a utilizzare Caching condiviso di Windows Azure e ho funzionato. Tuttavia non ho usato OutputCacheAttributes ma ho usato direttamente l'oggetto DataCache. –

+1

Esiste un nuovo servizio di cache distribuita, accessibile da tutti i servizi di Azure (siti Web, ruolo di lavoro, ruolo Web, VM, ecc.) - attualmente in anteprima. Vedi [this] (http://weblogs.asp.net/scottgu/archive/2013/09/03/windows-azure-new-distributed-dedicated-high-performance-cache-service-more-cool-improvements.aspx) di Scott Guthrie. – seldary