Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
<img src="//i.stack.imgur.com/WM7S8.png" height="16" width="18" alt="" class="sponsor tag img">servicestack 在连接到同一服务URI的单个进程中使用ServerEventsClient的多个实例_<img Src="//i.stack.imgur.com/WM7S8.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">servicestack_Server Sent Events - Fatal编程技术网 servicestack 在连接到同一服务URI的单个进程中使用ServerEventsClient的多个实例,servicestack,server-sent-events,servicestack,Server Sent Events" /> servicestack 在连接到同一服务URI的单个进程中使用ServerEventsClient的多个实例,servicestack,server-sent-events,servicestack,Server Sent Events" />

servicestack 在连接到同一服务URI的单个进程中使用ServerEventsClient的多个实例

servicestack 在连接到同一服务URI的单个进程中使用ServerEventsClient的多个实例,servicestack,server-sent-events,servicestack,Server Sent Events,当我在连接到同一URI的单个.NET应用程序中使用多个ServerEventsClient实例时,任何后续的GET/POST etc调用都会无限期地阻塞并超时。我相信这与@mythz()在回答中提到的DDoS保护有关。只有当服务器和客户端不在同一台PC上运行时,才会发生这种情况 我可以通过确保只为给定的URI创建一个ServerEventsClient来解决这个问题,但是在我投入太多工作之前,我想确保这是经过设计的,并且没有更简单的解决方法来处理这个问题。还有其他人遇到过这个问题吗?Servic

当我在连接到同一URI的单个.NET应用程序中使用多个ServerEventsClient实例时,任何后续的GET/POST etc调用都会无限期地阻塞并超时。我相信这与@mythz()在回答中提到的DDoS保护有关。只有当服务器和客户端不在同一台PC上运行时,才会发生这种情况

我可以通过确保只为给定的URI创建一个ServerEventsClient来解决这个问题,但是在我投入太多工作之前,我想确保这是经过设计的,并且没有更简单的解决方法来处理这个问题。还有其他人遇到过这个问题吗?

ServiceStack在幕后使用.NET
HttpWebRequest
,每个域都有内置的请求限制

您应该能够通过增加来增加限额,例如:

或者,您应该能够通过Web.config中的
增加此限制:

<configuration>  
  <system.net>  
    <connectionManagement>  
      <add address = "http://www.contoso.com" maxconnection = "4" />  
      <add address = "*" maxconnection = "10" />  
    </connectionManagement>  
  </system.net>  
</configuration>  

谢谢@mythz。这解决了问题,也帮助我更好地理解。我仍然可以添加代码以确保每个URI只创建一个ServerEventsClient,因为无论“ConnectionLimit”是什么,理论上我可能会耗尽连接。(我正在编写一个库,其他应用程序将使用它,因此我无法预测,也不想指定它们如何使用它)。
<configuration>  
  <system.net>  
    <connectionManagement>  
      <add address = "http://www.contoso.com" maxconnection = "4" />  
      <add address = "*" maxconnection = "10" />  
    </connectionManagement>  
  </system.net>  
</configuration>