Web角色 - 实现角色内缓存导致应用程序崩溃(本地+生产)

时间:2013-09-22 08:03:02

标签: c# caching azure

我正在开发一个网站项目(转换为Web角色)以使用角色内的Windows Azure缓存。一切都运行得很完美,但是当我启用缓存时,应用程序崩溃,在IIS日志或事件查看器中显然没有任何有用的消息。我得到的只是 -

活动代码:3005 事件消息:发生了未处理的异常。 活动时间:21/09/2013 23:59:39 活动时间(UTC):21/09/2013 22:59:39 事件ID:440c14c6c5f848b683cf33b2a553b42c 事件顺序:3 事件发生:1 活动详细代码:0

异常信息:     异常类型:SocketException     异常消息:没有这样的主机    在Microsoft.ApplicationServer.Caching.AsyncResultNoResult.EndInvoke()    在Microsoft.ApplicationServer.Caching.AsyncResult`1.EndInvoke()    在Microsoft.ApplicationServer.Caching.SocketConnectionFactory.EndConnect(IAsyncResult asyncResult)    在Microsoft.ApplicationServer.Caching.TcpClientChannelFactory.TcpConnectionCallback(IAsyncResult result)

我已经拥有Windows Azure SDK 2.1以及Windows Azure Caching 2.1版本。我试过这里建议的解决方案无济于事 -

http://blogs.msdn.com/b/cie/archive/2013/08/08/windows-azure-caching-2-1-0-0-no-such-host-is-known.aspx

我有2个Web角色实例,其中包含服务配置中的以下设置 -

<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel" value="4" />
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.NamedCaches" value="{&quot;caches&quot;:[{&quot;name&quot;:&quot;default&quot;,&quot;policy&quot;:{&quot;eviction&quot;:{&quot;type&quot;:0},&quot;expiration&quot;:{&quot;defaultTTL&quot;:10,&quot;isExpirable&quot;:true,&quot;type&quot;:1},&quot;serverNotification&quot;:{&quot;isEnabled&quot;:false}},&quot;secondaries&quot;:0}]}" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel" value="4" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.CacheSizePercentage" value="30" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ConfigStoreConnectionString" value="UseDevelopmentStorage=true" />

以及web角色的web.config中的以下条目

<sessionState mode="Custom" customProvider="defaultProvider" cookieless="UseCookies">
<providers>
<add cacheName="default" name="defaultProvider" dataCacheClientName="default" applicationName="TravelEagle" type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache" />
</providers>
</sessionState>

<dataCacheClients>
<dataCacheClient name="default">
<autoDiscover isEnabled="true" identifier="TravelEagle" />
</dataCacheClient>    
</dataCacheClients>
<cacheDiagnostics>
<crashDump dumpLevel="Off" dumpStorageQuotaInMB="100" />
</cacheDiagnostics>

如果我尝试使用Azure模拟器运行应用程序,则会出现另一个错误:

为应用程序池“5e45b35f-ccd3-485e-8f12-b70178ffd1a3”提供服务的进程意外终止。进程ID为'11096'。进程退出代码为'0xfffffffe'。

{0}无法刷新查找表,异常:{Microsoft.Fabric.Common.OperationCompletedException:操作已完成且异常---&gt; Microsoft.Fabric.Federation.RoutingException:目标节点显式中止了该操作    ---内部异常堆栈跟踪结束---    在Microsoft.Fabric.Common.OperationContext.End()    在Microsoft.Fabric.Federation.FederationSite.EndRoutedSendReceive(IAsyncResult ar)    在Microsoft.Fabric.Data.ReliableServiceManager.EndRefreshLookupTable(IAsyncResult ar)}

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

我必须提供我的存储帐户连接字符串而不是usedevelopmentstorage。

相关问题