5

我有一个客户端进程,它尝试使用“BasicHttpBinding”向服务器发出多个并发请求。客户端尝试向服务器发出 10 个或更多并发请求,但服务器日志表明在任何时候最多只有 2 个并发请求正在进行,这显然会减慢客户端生成的吞吐量。客户端似乎正在进行一些节流。服务提供商提供给我们的配置包含如下行为:

        <basicHttpBinding>
            <binding name="BasicHttpBinding_IService" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="01:00:00"
                allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="2047483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2047483647"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="1073741823"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="TransportCredentialOnly">
                    <transport clientCredentialType="Windows" proxyCredentialType="None"
                        realm="" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
            </binding>
        </basicHttpBinding>

此外,我们在客户端中有以下连接管理条目:

<system.net>
    <connectionManagement>
        <add address="*" maxconnection="10" />
    </connectionManagement>
</system.net>

那么我需要做什么才能防止在客户端上发生限制,以便对 WCF 服务的最大并发请求可能超过 2 个,谢谢

4

1 回答 1

4
System.Net.ServicePointManager.DefaultConnectionLimit = 100;
于 2013-09-17T14:12:01.930 回答