2009-09-14 25 views
3

我有WCF客戶端向服務發送請求。我的業務代碼調用客戶端API每秒發送300+個請求。但我的客戶端根據我的服務和WCF ServicePoint的性能計數器只發送大約50個服務。爲什麼我的客戶端如此緩慢地發送請求?

而且我在代碼中將ServicePointManager.DefaultConnectionLimit增加到1000,並且在服務配置文件中將maxConCurrentCalls設置爲1000,但幾乎沒有改進。

我想在WCF客戶端可能會有請求發送隊列。有什麼方法可以配置它並加快我的客戶端速度。

這裏是我的客戶端配置:

<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> 
+0

簡單測試將啓動兩個併發客戶端,並查看它們是否以兩倍於服務器的速率生成命中。如果他們這樣做,這是一個客戶端限制問題。 – TheJacobTaylor

+0

我找到了原因。有一個由IIS 6.0定義的線程限制(50)。針對此問題的解決方案是使用定製主機託管我的服務。 –

回答

1

你可能會擊中了走出去的HTTP連接的連接限制:

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

注意默認值是2

+0

是否與ServicePointManager.DefaultConnectionLimit相同?我已經更新到1000代碼。 –

+0

我不認爲它是一樣的。嘗試將上述配置放入wcf客戶端的配置文件中。 –

+0

將ServicePointManager.DefaultConnectionLimit設置爲8(在我的.NET 4應用程序中),因此它們看起來是相同的。 –

相關問題