我正在使用smartthreadpool排队以下功能,所有内容都运行顺畅,直到有一段时间,然后cpu上升到98-99%
我用dotTrace拍了一张快照,它告诉我下面的函数正在耗尽大部分cpu ..任何想法可能是什么?
public string websocketExtended(string URL, int socketTimeOut)
{
string _html = "";
HttpWebResponse _wResp;
try
{
HttpWebRequest _wReq;
System.Text.ASCIIEncoding _enc = new System.Text.ASCIIEncoding();
_wReq = (HttpWebRequest)WebRequest.Create(URL);
_wReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
_wReq.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
_wReq.Method = "GET";
_wReq.CookieContainer = cookieJarf;
_wReq.KeepAlive = false;
_wReq.Timeout = socketTimeOut;
_wReq.ReadWriteTimeout = socketTimeOut;
_wResp = (HttpWebResponse)_wReq.GetResponse();
using (StreamReader sr = new StreamReader(_wResp.GetResponseStream()))
{
_html = sr.ReadToEnd();
}
cookieJarf = _wReq.CookieContainer;
_wResp.Close();
}
catch (WebException wexc1)
{
if (wexc1.Status == WebExceptionStatus.ProtocolError)
{
return "";
}
}
return _html;
}