Managing concurrent connections in IIS7
I'm having an issue with my hosting provider (winhost.com). My app is built on ASP.NET 4 MVC 3. Up until a few days ago, everything was running fine. All of a sudden I've started getting 503 errors when trying to access my site (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开发者_JAVA技巧 the page for the current step in the puzzle. Basically I'm screen scraping wikipedia.org, injecting some html and then displaying the results. All of my web requests are closed immediately after receiving the data.
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. What I can see from my end is that only 1 request is ever allowed to be made to wikipediamaze.com at a time. If you keep refreshing the page you'll eventually get the HTML but all subsequent requests (css,images,js) all get the 503 error. Even pages that don't ever call out to 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? 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. 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.
<system.net>
<connectionManagement>
<add address="*" maxconnection="48" />
</connectionManagement>
</system.net>
精彩评论