Wcf 为什么我的客户发送请求这么慢?
我有WCF客户端向服务发送请求。我的业务代码调用客户端API,每秒发送300多个请求。但根据我的服务和WCF ServicePoint的te性能计数器,我的客户端只向服务发送了大约50个 我在代码中将ServicePointManager.DefaultConnectionLimit增加到1000,并在服务配置文件中将maxConCurrentCalls设置为1000,但几乎没有改进 我猜WCF客户端中可能有队列等待发送请求。有没有办法配置它并加速我的客户端 以下是我的客户端配置:Wcf 为什么我的客户发送请求这么慢?,wcf,wcf-client,performance,Wcf,Wcf Client,Performance,我有WCF客户端向服务发送请求。我的业务代码调用客户端API,每秒发送300多个请求。但根据我的服务和WCF ServicePoint的te性能计数器,我的客户端只向服务发送了大约50个 我在代码中将ServicePointManager.DefaultConnectionLimit增加到1000,并在服务配置文件中将maxConCurrentCalls设置为1000,但几乎没有改进 我猜WCF客户端中可能有队列等待发送请求。有没有办法配置它并加速我的客户端 以下是我的客户端配置: <ba
<basicHttpBinding>
<binding name="Binding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2000000" maxBufferPoolSize="524288" maxReceivedMessageSize="2000000"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
您可能正在达到外部http连接的连接限制:
<system.net>
<connectionManagement>
<add address="*" maxconnection="8"/>
</connectionManagement>
</system.net>
注意,默认值为2。是否与ServicePointManager.DefaultConnectionLimit相同?我已经把代码更新到1000,我不认为是一样的。尝试将上述配置放入wcf客户端的配置文件中。将ServicePointManager.DefaultConnectionLimit设置为8(无论如何,在我的.NET 4应用程序中),因此它们看起来是相同的。一个简单的测试是启动两个并发客户端,看看它们是否以两倍于服务器的速率产生命中。如果他们这样做了,那就是客户端节流问题。我已经找到了原因。IIS 6.0定义了线程限制(50)。此问题的解决方案是使用自定义主机托管我的服务。