2010-09-28 17 views
18

我有一個服務調用另一臺機器上的服務,並且我能得到的最大併發連接數是2.我嘗試更改WCF服務行爲的限制,影響。我讀過這是因爲從客戶端機器到服務器的2個併發連接的HTTP限制。我如何克服這一點?在兩臺機器上的操作系統是服務器2003從單個客戶端到服務的多個併發WCF調用

配置:

<serviceBehaviors> 
    <behavior name="MyServiceTypeBehaviors"> 
     <serviceMetadata httpGetEnabled="true" /> 
     <serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100"/> 
    </behavior> 
    </serviceBehaviors> 

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

回答

26

你有從客戶端代碼(從調用其他服務的服務中)克服這一點。在服務應用程序,以提高連接的初始化使用此代碼:

System.Net.ServicePointManager.DefaultConnectionLimit = 10; 
+0

非常感謝,就是這樣! – Kevin 2010-09-28 19:16:15

6

嘗試在您的客戶端應用程序將在您的app.config是這樣的:

<system.net> 
    <connectionManagement> 
     <add address="*" maxconnection="100" /> 
    </connectionManagement> 
</system.net> 
+0

沒有改變性能 – Kevin 2010-09-28 17:26:05

+1

謝謝....它的工作 – Dalton 2016-03-16 12:08:10

+0

會不會有對應用程序產生任何影響添加該配置後? – 2016-09-19 05:58:09