我正在做一个项目,它多次调用一个网址
request = (HttpWebRequest)WebRequest.Create(url);
request.GetResponse();
这是我的代码。它在一个循环中,它工作了 2 次,但在第三次迭代时它挂起。没有崩溃或错误。请帮忙。任何帮助将不胜感激。
错误:等待 20 分钟后。
System.Net.WebException was unhandled
Message=The operation has timed out
Source=System
StackTrace:
at System.Net.HttpWebRequest.GetResponse()
at ConsoleApplication1.Program.Main(String[] args) in C:\WorkSpace\ConsoleApplication1\ConsoleApplication1\Program.cs:line 48
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
内部异常: