0

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.

PhilPursglove
  • 12,511
  • 5
  • 46
  • 68

1 Answers1

1

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.

Community
  • 1
  • 1
PhilPursglove
  • 12,511
  • 5
  • 46
  • 68
  • Thank you Phil. I have tried Simon's project, I successfully load the items in the L2 cache in a Criteria query, buy when I re-run the query, Nhibernate hits the database instead of reading the data from the cache. Has anyone performed a successfull implementation of Simon's project ? Thank you, C. – user1140689 Jan 12 '12 at 08:27
  • It is working fine for me - but then I would say that wouldn't I ;O). Feel free to contact me via my blog and I will look into it further for you. – s1mm0t Jan 12 '12 at 15:19
  • Thank you Simon. Although I have made it work (the config file was missing localCache section, that was the cause of my problem), yet I might have some issues in understanding how everything works. I appreciate your commitment, and I might write you a larger email soon. Thank you again. – user1140689 Jan 16 '12 at 09:09