有多个url,我使用异步请求调用url,但是大多数请求都超时了。url是可访问的,异步请求只有其中一个url,才能得到响应。代码如下:
foreach (var url in URLs)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
IAsyncResult result = (IAsyncResult)request.BeginGetResponse(new AsyncCallback(RequestCallback), request);
ThreadPool.RegisterWaitForSingleObject(result.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), request, request.Timeout, true);
}
有人可以告诉我原因吗?