AppFabric 缓存 - 现有连接被远程主机强制关闭

发布于 2024-09-02 00:05:06 字数 1665 浏览 2 评论 0原文

我正在尝试在本地开发环境中启动并运行 AppFabric 缓存。我安装了 Windows Server AppFabric Beta 2 Refresh,并且配置了缓存群集和主机并开始在 Windows 7 64 位上运行。我在集成模式下的 v4.0 应用程序池下的本地 IIS 网站中运行我的 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:         }

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:         }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

苦妄 2024-09-09 00:05:06

我也遇到了类似的问题,我的问题是我没有向缓存客户端授予适当的权限。为了快速验证这是问题所在,我将授予每个人帐户对缓存的访问权限。如果这解决了问题,那么请考虑限制对适当帐户而不是所有人的访问。这可以通过“缓存管理员 Windows PowerShell”执行以下命令来完成,该命令位于 Windows Server AppFabric 开始菜单文件夹中:

Grant-CacheAllowedClientAccount everyone

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
吾家有女初长成 2024-09-09 00:05:06

我也遇到了这个问题,我在此线程中找到了答案:

http://social.msdn.microsoft.com/Forums/vstudio/en-US/c27063e7-1579-4d62-9104-87076d1c8d98/client-caching-error-errorcodeerrca0017substatuses0006

答案:

由于安全属性不匹配,您会看到此错误
客户端和服务器之间。

在您的客户端代码中,您禁用了安全性(Mode=None 且
PotectionLevel=None) 而缓存服务器使用 mode=Transport 并且
PotectionLevel=EncryptAndSign(默认为 Beta2Fresh 位)。

执行以下任一操作:

1) 在客户端代码中使用默认安全性,即
配置.SecurityProperties =new DataCacheSecurity();

2) 禁用服务器的安全性以与您现有的客户端匹配
代码。使用 Powershell cmdlet Set-CacheClusterSecurity -SecurityMode
无 -ProtectionLevel 无

I had this problem too and I found the answer in this thread:

http://social.msdn.microsoft.com/Forums/vstudio/en-US/c27063e7-1579-4d62-9104-87076d1c8d98/client-caching-error-errorcodeerrca0017substatuses0006

The answer:

You are seeing this error because of the security property mismatch
between client and server.

In your client code you disabled the security (Mode=None and
PotectionLevel=None) whereas the cache server uses mode=Transport and
PotectionLevel=EncryptAndSign (default in Beta2Fresh bits).

Do either of the following:

1) In the client code use the default security i.e.
configuration.SecurityProperties =new DataCacheSecurity();

2) Disable the security at server to match with your existing client
code. Use Powershell cmdlet Set-CacheClusterSecurity -SecurityMode
None -ProtectionLevel None

双马尾 2024-09-09 00:05:06

如果您使用 DataCacheFactoryConfiguration 对象,是否会遇到同样的问题?例如,

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();
    ...
}

您是否在防火墙上打开了端口?

也许检查事件日志中的条目 - 它们可能会提供有关正在发生(或未发生)的事情的线索。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文