我正在尝试在本地开发环境中启用AppFabric缓存。我已经安装了Windows Server AppFabric Beta 2 Refresh,并在Windows 7 64位上配置和启动了缓存集群和主机。我在本地IIS网站下的v4.0应用程序池中以集成模式运行我的MVC2网站。
HostName : CachePort Service Name Service Status Version Info
-------------------- ------------ -------------- ------------
SN-3TQHQL1:22233 AppFabricCachingService UP 1 [1,1][1,1]
我已经按照以下方式配置了我的web.config:
<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>
当我尝试初始化DataCacheFactory时,出现了错误:
protected CacheService()
{
_cacheFactory = new DataCacheFactory(); <-- Error here
_defaultCache = _cacheFactory.GetDefaultCache();
}
我看到了ASP.NET黄色错误屏幕,并显示以下内容:
现有连接被远程主机强制关闭
描述: 在当前Web请求执行期间发生未处理的异常。请查看堆栈跟踪以获取有关错误的更多信息以及代码中出现的位置。
异常详细信息: System.Net.Sockets.SocketException: 现有连接被远程主机强制关闭
源错误:
Line 21: protected CacheService()
Line 22: {
Line 23: _cacheFactory = new DataCacheFactory();
Line 24: _defaultCache = _cacheFactory.GetDefaultCache();
Line 25: }