NHibernate + AppFabric缓存
我使用 AppFabric 作为 NHibernate 2L 缓存提供程序。
我已经安装了 AppFabric 缓存服务,配置了缓存集群以及除默认缓存之外的一个额外缓存:
<dataCache size="Small">
<caches>
<cache consistency="StrongConsistency" name="NHibernate">
<policy>
<eviction type="Lru" />
<expiration defaultTTL="10" isExpirable="true" />
</policy>
</cache>
<cache consistency="StrongConsistency" name="default">
<policy>
<eviction type="Lru" />
<expiration defaultTTL="10" isExpirable="true" />
</policy>
</cache>
</caches>
<hosts>
<host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
hostId="963417840" size="2047" leadHost="true" account="ZEUS\CATALINP"
cacheHostName="AppFabricCachingService" name="ZEUS"
cachePort="22233" />
</hosts>
</dataCache>
在缓存提供程序方面一切似乎都正常。
app.config 中使用的缓存客户端配置如下:
<dcacheClient localCache ="True" deployment="simple">
<localCache isEnabled="True" sync="TimeoutBased" ttlValue="300" />
<hosts>
<host name="ZEUS" cachePort="22233" cacheHostName="AppFabricCachingService"/>
</hosts>
</dcacheClient>
没有什么特别的,只是通用设置。
然而,当我运行应用程序时,我可以在调试器中看到以下输出:
已调用 DeadServerCallback,服务器 URI: net.tcp://ZEUS:22233/AppFabricCachingService DeadServerCallback: 匹配我的服务器,清理待处理请求 SendMsgAndWait:远程 存储操作失败:msgId = 1 ExecuteAPI:响应为 Null,msgId = 1
最后,应用程序崩溃并显示以下消息:
“错误代码:Cache::Get:无法联系缓存 服务。联系管理员并参考产品帮助文档 由于可能的原因。”
缓存服务似乎配置正确(我已经通过Powershell命令成功连接到它),NHibernate配置似乎也正确,但NHibernate无法连接到缓存服务。
有人遇到过什么情况吗 类似?
谢谢,
C.
I use AppFabric as a NHibernate 2L cache provider.
I have installed AppFabric cache service, configured the cache cluster and one extra cache apart from the default one:
<dataCache size="Small">
<caches>
<cache consistency="StrongConsistency" name="NHibernate">
<policy>
<eviction type="Lru" />
<expiration defaultTTL="10" isExpirable="true" />
</policy>
</cache>
<cache consistency="StrongConsistency" name="default">
<policy>
<eviction type="Lru" />
<expiration defaultTTL="10" isExpirable="true" />
</policy>
</cache>
</caches>
<hosts>
<host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
hostId="963417840" size="2047" leadHost="true" account="ZEUS\CATALINP"
cacheHostName="AppFabricCachingService" name="ZEUS"
cachePort="22233" />
</hosts>
</dataCache>
Everything seems ok on the cache provider side.
Cache client's configuration, as used in app.config, is the following:
<dcacheClient localCache ="True" deployment="simple">
<localCache isEnabled="True" sync="TimeoutBased" ttlValue="300" />
<hosts>
<host name="ZEUS" cachePort="22233" cacheHostName="AppFabricCachingService"/>
</hosts>
</dcacheClient>
Nothing special, just the common settings.
Yet, when I run the applicacion, I can see the following output in the debugger:
DeadServerCallback Called, Server URI:
net.tcp://ZEUS:22233/AppFabricCachingService DeadServerCallback:
Matches My Server, Cleaning Pending Requests SendMsgAndWait: Remote
Store Operation Failed: msgId = 1 ExecuteAPI: Response is Null, msgId
= 1
Finally, the application crashed with the following message:
"ErrorCode:Cache::Get : Could not contact the cache
service. Contact administrator and refer to product help documentation
for possible reasons."
The cache service seems to be correctly configured (I have succeeded to connect to it through Powershell commands), the NHibernate configuration seem to be correct as well, yet the NHibernate cannot connect to the cache service.
Has anybody experiences something similar ?
Thank you,
C.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
NHibernate Velocity 提供程序已损坏,无法与 AppFabric 一起使用。有关详细信息,请参阅此问题,然后转到此处了解 s1mm0t 的 AppFabric 提供商。
The NHibernate Velocity provider is broken and will not work with AppFabric. See this question for details, and then go here for s1mm0t's provider for AppFabric.