简体   繁体   English

通过 HttpWebRequest 向服务器发出多个请求

[英]Make more than one request by HttpWebRequest to Server

Friends,i want to scrape a third party web pages and get information from there by httpwebrequest c#.net.朋友们,我想抓取第三方网页并通过httpwebrequest c#.net 从那里获取信息。 I made a simple application in asp.net,c#.我在 asp.net,c# 中做了一个简单的应用程序。 and hosted in webserver IIS 7 that enable user to scrape web page easily.并托管在网络服务器 IIS 7 中,使用户能够轻松抓取网页。

It is working fine by single user.单个用户运行良好。 but problem is that when more than one user is requesting at the same time then server block the request.但问题是,当多个用户同时请求时,服务器会阻止该请求。 the server allow max 2 concurrent request服务器允许最多 2 个并发请求

My application is running on IIS7, asp.net 4.0.我的应用程序在 IIS7、asp.net 4.0 上运行。

any help please任何帮助请

If the limit is managed by the remote server then there's probably not much you can do.如果限制由远程服务器管理,那么您可能无能为力。 It's there to prevent spamming and that's what it's doing.它的目的是防止垃圾邮件,这就是它正在做的事情。

It does sound like you're just hitting the default connection limit for your own machine though.不过,听起来您只是达到了自己机器的默认连接限制。 Have a look at the ServicePointManager.DefaultConnectionLimit Property看看ServicePointManager.DefaultConnectionLimit 属性

Use it like this:像这样使用它:

ServicePointManager.DefaultConnectionLimit = 1000;

Some reading on it here .这里阅读一些内容。

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

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