简体   繁体   English

管理IIS7中的并发连接

[英]Managing concurrent connections in IIS7

I'm having an issue with my hosting provider (winhost.com). 我的托管服务提供商(winhost.com)存在问题。 My app is built on ASP.NET 4 MVC 3. Up until a few days ago, everything was running fine. 我的应用程序是基于ASP.NET 4 MVC 3.直到几天前,一切运行正常。 All of a sudden I've started getting 503 errors when trying to access my site (wikipediamaze.com). 突然间,我在尝试访问我的网站时遇到了503错误(wikipediamaze.com)。 It doesn't happen all the time, just most of the time. 它不会一直发生,大部分时间都是如此。

When someone starts playing the game a request is made to wikipedia.org to get the contents of the page for the current step in the puzzle. 当有人开始玩游戏时,会向wikipedia.org发出请求,以获取拼图中当前步骤的页面内容。 Basically I'm screen scraping wikipedia.org, injecting some html and then displaying the results. 基本上我是屏幕抓wikipedia.org,注入一些HTML然后显示结果。 All of my web requests are closed immediately after receiving the data. 我的所有Web请求在收到数据后立即关闭。

What winhost is telling me is that there are connections remaining open and causing any additional requests to the site to get the 503 Service Unavailable Error. winhost告诉我的是,有些连接仍处于打开状态,并导致对该站点的任何其他请求以获取503服务不可用错误。 What I can see from my end is that only 1 request is ever allowed to be made to wikipediamaze.com at a time. 从我的结论我可以看到,一次只允许向wikipediamaze.com提出1个请求。 If you keep refreshing the page you'll eventually get the HTML but all subsequent requests (css,images,js) all get the 503 error. 如果你不断刷新页面,你最终会获得HTML,但所有后续请求(css,images,js)都会得到503错误。 Even pages that don't ever call out to wikipedia.org. 甚至还没有打电话给wikipedia.org的页面。

If it was an issue with connection throttling in IIS, do both incoming and outgoing (requests made internally) fall in to the same bucket? 如果在IIS中出现连接限制问题,那么传入和传出(内部请求)是否都属于同一个存储桶? If I'm sure all of my connections are being closed (and I've never had this issue before) what else could cause this? 如果我确定我的所有连接都已关闭(之前我从未遇到过此问题)还有什么可能导致此问题?

It's a hosted environment so my hands are kind of tied, and I know all of this is pertty vague, but if someone had any insight, it would be much appreciated. 这是一个托管环境,所以我的双手都很紧张,我知道所有这些都是模糊的,但如果有人有任何见解,那将非常感激。

My first suggestion is to make sure that you're closing your connections (preferably using Using statements) when you're done with them because then they can be re-used. 我的第一个建议是确保在完成连接后关闭连接(最好使用Using语句),因为它们可以重复使用。 I know you've said that you're closing them already but sometimes you have to dispose of them. 我知道你已经说过你已经关闭了它们,但有时你必须处理掉它们。

In addition to this you can change the number of connections that your server will make to other servers by putting the following in your web.config file. 除此之外,您还可以通过将以下内容添加到web.config文件中来更改服务器将对其他服务器建立的连接数。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM