首页 文章

AppFabric缓存将大对象添加到远程服务器

提问于
浏览
1

我正在为Windows Server 1.1使用AppFabric缓存 . 我正在尝试将80MB的对象添加到位于网络上另一台服务器上的缓存中 . 我收到以下错误:

ErrorCode:SubStatus:暂时失败 . 请稍后重试 . (一个或多个指定的缓存服务器不可用,这可能是由繁忙的网络或服务器引起的 . 对于内部部署缓存集群,还要验证以下条件 . 确保已为此客户端帐户授予安全权限,并检查AppFabric允许缓存服务通过所有缓存主机上的防火墙 . 服务器上的MaxBufferSize必须大于或等于从客户端发送的序列化对象大小 . ):inner System.ServiceModel.CommunicationException:套接字因异步而中止从套接字接收没有在分配的超时00:01:00内完成 . 分配给此操作的时间可能是较长超时的一部分 . ---> System.Net.Sockets.SocketException:已 Build 的连接由主机中的软件在System.ServiceModel.Channels.SocketConnection.Write(Byte []缓冲区,Int32偏移量,Int32大小,布尔立即数,TimeSpan中止超时)---内部异常堆栈跟踪结束---在System.ServiceModel.Channels.SocketConnection上的System.ServiceModel.Channels.SocketConnection.Write(Byte []缓冲区,Int32偏移量,Int32大小,布尔值立即,TimeSpan超时) .Write(Byte [] buffer,Int32 offset,Int32 size,Boolean immediate,TimeSpan timeout,BufferManager bufferManager)在System.ServiceModel.Channels.BufferedConnection.WriteNow(Byte []缓冲区,Int32偏移量,Int32大小,TimeSpan超时,BufferManager bufferManager )System.ServiceModel.Channels.BufferedConnection.Write(Byte [] buffer,Int32 offset,Int32 size,Boolean immediate,TimeSpan timeout,BufferManager bufferManager)at System.ServiceModel.Channels.FramingDuplexSessionChannel.OnSend(Message message,TimeSpan timeout)在System.ServiceModel.Channels.OutputChannel.Send(消息消息,TimeSpan超时)在Microsoft.ApplicationServer.Caching.WcfClientChannel.SendOnChannel(EndpointID endpoints ,TimeSpan和超时,WaitCallback回调,对象状态,布尔异步,IDuplexSessionChannel通道,消息消息)

我可以将较小的对象添加到远程服务器中,这显然与大小有关 . 我还为AppFabric安装了累积更新包3 . 我已禁用所有安全性 . 有任何想法吗?

服务器配置文件:

<configuration>
    <configSections>
        <section name="dataCache" type="Microsoft.ApplicationServer.Caching.DataCacheSection, Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </configSections>
    <dataCache size="Small">
        <caches partitionCount="32">
            <cache consistency="StrongConsistency" name="default" minSecondaries="0">
                <policy>
                    <eviction type="Lru" />
                    <expiration defaultTTL="1440" isExpirable="true" />
                </policy>
            </cache>
        </caches>
        <hosts>
            <host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
                hostId="1216617116" size="6126" leadHost="true" account="test$"
                cacheHostName="AppFabricCachingService" name="test.com"
                cachePort="22233" />
        </hosts>
        <advancedProperties>
            <securityProperties mode="None" protectionLevel="None">
                <authorization>
                    <allow users="IIS AppPool\test" />
                </authorization>
            </securityProperties>
            <transportProperties maxBufferPoolSize="26843545600" maxBufferSize="838860800" receiveTimeout="40000" />
        </advancedProperties>
        <deploymentSettings>
            <deploymentMode value="RoutingClient" />
        </deploymentSettings>
    </dataCache>
</configuration>

客户端的Web.config部分试图推送到AppFabric:

<dataCacheClient requestTimeout="60000" channelOpenTimeout="12000" maxConnectionsToServer="1">
    <localCache isEnabled="false" sync="TimeoutBased" ttlValue="300" objectCount="10000"/>
    <clientNotification pollInterval="300" maxQueueLength="10000"/>        
    <securityProperties mode="None" protectionLevel="None" />
    <transportProperties connectionBufferSize="131072" maxBufferPoolSize="568435456" maxBufferSize="183886080" maxOutputDelay="2" channelInitializationTimeout="60000" receiveTimeout="60000" />  </dataCacheClient>

连接在代码中 Build 如下:

DataCacheServerEndpoint[] servers = new DataCacheServerEndpoint[1];
                servers[0] = new DataCacheServerEndpoint("remoteServerName", 22233);

                DataCacheFactoryConfiguration factoryConfig = new DataCacheFactoryConfiguration();
                factoryConfig.Servers = servers;

                //Pass configuration settings to cacheFactory constructor
                _factory = new DataCacheFactory(factoryConfig);

                _cache = _factory.GetCache("default");

最后是将项添加到缓存的代码:

_cache.CreateRegion(region);                             
_cache.Put(key, value, new TimeSpan(0, timeToLive, 0), tag, region);

1 回答

  • 2

    此问题的解决方案是在客户端web.config中增加requestTimeout并删除receiveTimeout设置 .

    web.config现在看起来像:

    <dataCacheClient requestTimeout="600000" channelOpenTimeout="12000" maxConnectionsToServer="1">
        <localCache isEnabled="false" sync="TimeoutBased" ttlValue="300" objectCount="10000"/>
        <clientNotification pollInterval="300" maxQueueLength="10000"/>        
        <securityProperties mode="None" protectionLevel="None" />
        <transportProperties connectionBufferSize="131072" maxBufferPoolSize="568435456" maxBufferSize="183886080" maxOutputDelay="2" channelInitializationTimeout="60000" />  </dataCacheClient>
    

相关问题