我一直在争取在Azure中使用角色内,共同定位的缓存(非专用)。
在我的MVC WebApi 2项目中web.config
:
<configSections>
<section name="dataCacheClients" type="Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core" allowLocation="true" allowDefinition="Everywhere" />
</configSections>
...
<dataCacheClients>
<dataCacheClient name="default" isCompressionEnabled="true">
<autoDiscover isEnabled="true" identifier="MyWebApiProject" />
<clientNotification pollInterval="300" />
<transportProperties maxBufferSize="1073741824" maxBufferPoolSize="1073741824"/>
</dataCacheClient>
</dataCacheClients>
角色的缓存属性设置:
我在Azure中抛出了以下异常:
Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode:SubStatus:暂时失败。 请稍后重试。 (一个或多个指定的缓存服务器是 不可用,这可能是由繁忙的网络或服务器引起的。对于 内部部署缓存集群,还验证以下条件。 确保已为此客户端授予安全权限 帐户,并检查是否允许AppFabric缓存服务 通过所有缓存主机上的防火墙。还有MaxBufferSize server必须大于或等于序列化对象大小 从客户发送。)附加信息:客户正在尝试 与服务器通信:net.tcp:// MyWebApiProject:24233。
当我关闭autoDiscover
时,就像这样:
<autoDiscover isEnabled="false" identifier="MyWebApiProject" />
然后我得到一个不同的例外:
Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode:SubStatus:服务器集合不能 空。
使用Compute Emulator在本地运行时没有任何问题。
答案 0 :(得分:2)
将Azure SDK从2.2升级到2.3后,此问题就停止了。