从单个客户端到服务的多个并发 WCF 调用 [英] Multiple concurrent WCF calls from single client to Service

查看:27
本文介绍了从单个客户端到服务的多个并发 WCF 调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个服务调用另一台机器上的服务,我可以获得的最大并发连接数是 2.我尝试更改 WCF 服务行为的限制,但没有效果.我读到这是因为从客户端计算机到服务器的 2 个并发连接的 HTTP 限制.我如何克服这个问题?两台机器的操作系统都是server 2003.

I have a service that calls a service on another machine and the most number of concurrent connections I can get is 2. I have tried changing the throttling on the WCF Service Behaviour but to no effect. I have read that it is because of the HTTP limit of 2 concurrent connections from a client machine to a server. How do I overcome this? The os on both machines is server 2003.

配置:

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

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

推荐答案

您必须从客户端代码(从调用其他服务的服务)中克服这个问题.在您的服务应用程序的初始化中使用此代码以增加连接:

You have to overcome this from client code (from the service which calls other service). Use this code in the initialization of your service application to increase connections:

System.Net.ServicePointManager.DefaultConnectionLimit = 10;

这篇关于从单个客户端到服务的多个并发 WCF 调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆