尝试在控制台/ Web应用程序中启动DataCache时遇到问题。经过很长一段时间后,抛出的异常如下图所示。我已经尝试了使用DataCacheFactory和简单DataCache的所有方法,但同样的问题正在发生。请帮我解决这个问题! Enters image description here
答案 0 :(得分:0)
似乎忘了配置.config文件。你通过Nuget安装了吗?您必须配置app.config,您必须设置“[缓存角色名称或服务端点]”:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dataCacheClients" type="Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core" allowLocation="true" allowDefinition="Everywhere" />
<section name="cacheDiagnostics" type="Microsoft.ApplicationServer.Caching.AzureCommon.DiagnosticsConfigurationSection, Microsoft.ApplicationServer.Caching.AzureCommon" allowLocation="true" allowDefinition="Everywhere" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<dataCacheClients>
<dataCacheClient name="default">
<!--To use the in-role flavor of Windows Azure Cache, set identifier to be the cache cluster role name -->
<!--To use the Windows Azure Cache Service, set identifier to be the endpoint of the cache cluster -->
<autoDiscover isEnabled="true" identifier="[Cache role name or Service Endpoint]" />
<localCache isEnabled="true" sync="TimeoutBased" objectCount="100000" ttlValue="300" />
<!--Use this section to specify security settings for connecting to your cache. This section is not required if your cache is hosted on a role that is a part of your cloud service. -->
<!--<securityProperties mode="Message" sslEnabled="false">
<messageSecurity authorizationInfo="[Authentication Key]" />
</securityProperties>-->
</dataCacheClient>
</dataCacheClients>
答案 1 :(得分:0)
很长一段时间后失败表明主要是网络问题。通过查看您尝试命中的端点是否无法访问或者dns是否正确解析等来检查这些内容。
您是否正在处理datacachefactory?端点应该是缓存门户提供的全部内容:yourchosencahcename.cache.windows.net