-
Notifications
You must be signed in to change notification settings - Fork 50
Description
hi im trying to send get or post request with ThreadPool But its show this error always
Error Code = Exception thrown: 'Leaf.xNet.HttpException' in Leaf.xNet.dll ("It turned out wait for a connection to the HTTP-server 'www.google.com'.")
and this is my code
var source;
var userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36";
try{
using (var request = new HttpRequest()
{
IgnoreProtocolErrors = true,
KeepAlive = true,
AllowAutoRedirect = true,
UserAgent = userAgent,
}.AddHeader(HttpHeader.Accept, "text/plain, /"))
{
response = request.Get("https://www.google.com/");
source = response.ToString();
}
}
catch (HttpException)
{
lblerror.Text = (int.Parse(lblerror.Text) + 1).ToString();
}
what is problem ? by the way its work with default thread but with ThreadPool has problem