这只发生在我的一台机器上.我认为这是一个环境配置问题.所有机器都运行ESET Smart Security软件防火墙.有任何想法吗?
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); } } }
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。