views:

351

answers:

2

I'm trying to get AppFabric cache up and running on my local development environment. I have Windows Server AppFabric Beta 2 Refresh installed, and the cache cluster and host configured and started running on Windows 7 64-bit. I'm running my MVC2 website in a local IIS website under a v4.0 app pool in integrated mode.

HostName : CachePort      Service Name            Service Status Version Info
--------------------      ------------            -------------- ------------
SN-3TQHQL1:22233          AppFabricCachingService UP             1 [1,1][1,1]

I have my web.config configured with the following:

  <configSections>
        <section name="dataCacheClient" type="Microsoft.ApplicationServer.Caching.DataCacheClientSection, Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" allowLocation="true" allowDefinition="Everywhere"/>
   </configSections>

   <dataCacheClient>
       <hosts>
           <host name="SN-3TQHQL1" cachePort="22233" />
       </hosts>
   </dataCacheClient>

I'm getting an error when I attempt to initialize the DataCacheFactory:

    protected CacheService()
    {
        _cacheFactory = new DataCacheFactory(); <-- Error here
        _defaultCache = _cacheFactory.GetDefaultCache();
    }

I'm getting the ASP.NET yellow error screen with the following:

An existing connection was forcibly closed by the remote host

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

Source Error:

Line 21:         protected CacheService()
Line 22:         {
Line 23:             _cacheFactory = new DataCacheFactory();
Line 24:             _defaultCache = _cacheFactory.GetDefaultCache();
Line 25:         }
+1  A: 

Do you get the same problem if you use a DataCacheFactoryConfiguration object? e.g.

protected CacheService()
{
    DataCacheFactoryConfiguration config;
    List<DataCacheServerEndpoint> endpoints;
    DataCacheFactory factory;
    DataCache cache;

    endpoints = new List<DataCacheServerEndpoint>();
    endpoints.Add(new DataCacheServerEndpoint("SN-3TQHQL1",22233));

    config = new DataCacheFactoryConfiguration();
    config.Servers = endpoints;

    factory = new DataCacheFactory(config);

    cache = factory.GetDefaultCache();
    ...
}

Have you opened the port on your firewall?

Maybe check entries in your event logs - they may offer clues as to what is (or isn't) happening.

PhilPursglove
@PhilPursglove - Yes, I've tried this as well. I've stepped through all the config as far as I could go and all seems to be configured correctly. +1
Wallace Breza
@Wallace Not sure then. Try a re-install perhaps?
PhilPursglove
@PhilPursglove - Reinstall didn't work either. I'm currently in contact with Microsoft to attempt to resolve this issue. I'll post a response once I hear back from them.
Wallace Breza
+2  A: 

I had a similar issue as well, and my problem was I had not given the proper permissions to the cache client. In order to quickly verify this is the issue I would grant the everyone account access to the cache. If this fixes the issue then look into limiting access to the appropriate account rather than everyone. This can done executing the following command via the "Caching Administrator Windows PowerShell", which is found in the Windows Server AppFabric start menu folder:

Grant-CacheAllowedClientAccount everyone
Blegger
Thank you! I've been trying to figure this out for a while, you're a lifesaver.
Wallace Breza