Bu yalnızca makinelerimden birinde gerçekleşir. Bence bir ortam konfigürasyon problemi. Tüm makineler ESET Smart Security yazılımı güvenlik duvarını çalıştırır. Herhangi bir fikir?DownloadStringAsync ilk aramanda 14 saniye süreyle iş parçacığını engeller
using System;
using System.Net;
using System.Diagnostics;
using System.Threading;
namespace Test
{
static class Program
{
[STAThread]
static void Main()
{
bool exit = false;
WebClient wc = new WebClient();
DateTime before = DateTime.Now;
wc.DownloadStringAsync(new Uri("http://74.125.95.147"), "First"); // IP Address of google, so DNS requests don't add to time.
wc.DownloadStringCompleted += delegate(object sender, DownloadStringCompletedEventArgs e)
{
Debug.WriteLine(e.UserState + " Call: " + (DateTime.Now - before));
if ((string)e.UserState == "First")
{
before = DateTime.Now;
wc.DownloadStringAsync(new Uri("http://74.125.95.147"), "Second");
}
else
exit = true;
};
/*
*
* Output:
*
* First Call: 00:00:13.7647873
* Second Call: 00:00:00.0740042
*
*/
while (!exit)
Thread.Sleep(1000);
}
}
}
Bu, Otomatik Proxy Algılama nedeniyle olabilir. WebClient.Proxy'yi GlobalProxySelection.GetEmptyWebProxy'ye ayarlarsanız herhangi bir değişiklik var mı? http://msdn.microsoft.com/en-us/library/system.net.webclient.proxy.aspx http://msdn.microsoft.com/en-us/library/system.net.globalproxyselection.getemptywebproxy.aspx – dtb
Evet, bu düzeltildi. Teşekkürler! İlk Çağrı: 00: 00: 00.1680096 İkinci Çağrı: 00: 00: 00.0400023 – Mango
@dtb, bunu yanıt olarak ekleyin. Bir oyu veya ikiyi hak ediyor. –