2

历史 在我的开发环境中,我一直在与运行 Windows Azure 模拟器时反复出现的错误作斗争。在我创建基于 Azure 模板的新解决方案和项目之前解决,同时重新安装 2012 年 10 月更新 SDK。然后我不得不将所有文件复制到新项目中。在经历所有这些之前,因为我知道它可以工作,所以我想看看是否还有其他事情可以做。

设置

  • 视窗 8
  • Visual Studio 2012 更新 1
  • IIS Express 8
  • Windows Azure 工具 - 2012 年 10 月
  • Windows Azure 缓存 1.8.1.0
  • ASP.NET MVC 4.0 项目
  • Web 角色(2 个实例)
  • 缓存工作者角色(2 个实例)
  • 在缓存工作角色上启用缓存并设置为专用角色(本地角色状态为:UseDevelopmentStorage=true)
  • 会话使用分布式缓存
  • 输出缓存使用分布式缓存

Web.config 设置

    <sessionState mode="Custom" customProvider="AFCacheSessionStateProvider" cookieName="abc_session">
          <providers>
            <add name="AFCacheSessionStateProvider" type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" applicationName="AFCacheSessionState" />
          </providers>
        </sessionState>

<outputCache defaultProvider="AFCacheOutputCacheProvider">
        <providers>
          <add name="AFCacheOutputCacheProvider" type="Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" applicationName="AFCacheOutputCache" />
        </providers>
      </outputCache>
    </caching>

  <dataCacheClients>
    <dataCacheClient name="default">
      <autoDiscover isEnabled="true" identifier="AppNameCacheWorkerRole" />
    </dataCacheClient>
  </dataCacheClients>

错误详情

ErrorCode<ERRCA0009>:SubStatus<ES0001>:Cache referred to does not exist
[DataCacheException: ErrorCode<ERRCA0009>:SubStatus<ES0001>:Cache referred to does not exist. Contact administrator or use the Cache administration tool to create a Cache.]
   Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ErrStatus errStatus, Guid trackingId, Exception responseException, Byte[][] payload, EndpointID destination) +767
   Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ResponseBody respBody, EndpointID destination) +149
   Microsoft.ApplicationServer.Caching.DataCacheFactory.EstablishConnection(IEnumerable`1 servers, RequestBody request, Func`3 sendMessageDelegate, DataCacheReadyRetryPolicy retryPolicy) +967
   Microsoft.ApplicationServer.Caching.<>c__DisplayClass4.<Initialize>b__1(RequestBody req) +198
   Microsoft.ApplicationServer.Caching.SocketClientProtocol.SendReceive(IVelocityRequestPacket request, Func`2 delegate, EndpointID& destination) +121
   Microsoft.ApplicationServer.Caching.SocketClientProtocol.Initialize(IEnumerable`1 servers) +1011
   Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCache(String cacheName, CreateNewCacheDelegate cacheCreationDelegate, DataCacheInitializationViaCopyDelegate initializeDelegate) +1103
   Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCache(String cacheName) +131
   Microsoft.Web.DistributedCache.DataCacheFactoryWrapper.CreateDataCacheFromFactory(DataCacheFactory factory, String cacheName) +63
   Microsoft.Web.DistributedCache.CacheHelpers.RunCacheCreationHooks(CacheConnectingEventArgs fetchingEventArgs, IDataCacheFactory dataCacheFactory, Object sender, EventHandler`1 fetchingHandler, EventHandler`1 fetchedHandler) +356
   Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider.CreateInternalProvider(IHttpRuntime httpRuntime, OutputCacheInitializationData initData, IDataCacheFactory dataCacheFactory, EventHandler`1 cacheFetching, EventHandler`1 cacheFetched) +399
   Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider.GetInternalProvider() +315
   Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider.Get(String key) +54
   System.Web.Caching.OutputCache.Get(String key) +80
   System.Web.Caching.OutputCacheModule.OnEnter(Object source, EventArgs eventArgs) +341
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165

杂项注释:

  • 相同的配置在部署到 Azure 时运行良好,因此与我的本地环境有关。
  • 当我设置了多个 Web 角色实例时,IIS Express 崩溃了,我找到了运行 Visual Studio 2010 SP1 来解决的建议。我在系统上安装了 VS2010,因为一个工具(相信是 SQL)安装了它。安装 SP1 解决了 IIS Express 崩溃的问题,但随后再次出现此错误。
  • 如果我注释掉上面列出的 OutputCache 节点,错误就会消失。
  • 如果我将缓存工作人员角色从专用角色切换到并置角色,错误就会消失。
4

2 回答 2

2

Spoke with Microsoft tech support and it appears this a known issue. Most of the time it can be resolved by forcing a refresh in the browser. I've had mixed success. The fix for this issue will be part of the next Azure SDK release.

于 2013-02-12T14:20:28.677 回答
0

This happens to me in production a lot! I upload my package to staging first, and have to always wait until all the instances are running before hitting the staging URL. Sometimes this error still occurs and I restart all my instances for it to fix itself.

于 2013-02-14T00:12:44.110 回答