WebClient“获取响应流的错误”

时间:2012-02-26 16:49:40

标签: c# webclient

我刚收到客户使用我编写的程序的错误报告,而且我一直在搜索这个错误,并且找不到任何有用的东西。错误是:

System.Net.WebException: Error getting response stream (ReadDone2): ReceiveFailure ---> System.Exception:    at System.Net.WebConnection.HandleError(WebExceptionStatus st, System.Exception e, System.String where)
   at System.Net.WebConnection.ReadDone(IAsyncResult result)
  at System.Net.WebConnection.HandleError (WebExceptionStatus st, System.Exception e, System.String where) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 
  at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0 
  at System.Net.WebClient.GetWebResponse (System.Net.WebRequest request) [0x00000] in <filename unknown>:0 
  at System.Net.WebClient.DownloadFileCore (System.Uri address, System.String fileName, System.Object userToken) [0x00000] in <filename unknown>:0 
  at System.Net.WebClient.<DownloadFileAsync>m__F (System.Object state) [0x00000] in <filename unknown>:0 

System.Net.WebException: Error getting response stream (ReadDone2): ReceiveFailure ---> System.Exception:    at System.Net.WebConnection.HandleError(WebExceptionStatus st, System.Exception e, System.String where)
   at System.Net.WebConnection.ReadDone(IAsyncResult result)
  at System.Net.WebConnection.HandleError (WebExceptionStatus st, System.Exception e, System.String where) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 
  at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0 
  at System.Net.WebClient.GetWebResponse (System.Net.WebRequest request) [0x00000] in <filename unknown>:0 
  at System.Net.WebClient.DownloadFileCore (System.Uri address, System.String fileName, System.Object userToken) [0x00000] in <filename unknown>:0 
  at System.Net.WebClient.<DownloadFileAsync>m__F (System.Object state) [0x00000] in <filename unknown>:0

该应用程序是游戏的启动程序,它可以下载任何不存在或过时的文件清单。它使用WebClient对象下载的所有文件,看起来像是WebClient :: DownloadFileAsync引发的错误,但是我找不到任何关于为什么会发生这种情况的文档。

任何帮助都会非常感激,我可以更快地解决这个星期一早上的问题!

干杯 乔

2 个答案:

答案 0 :(得分:0)

客户端是否使用代理?

如果是,您是否将代理附加到WebClient对象?

您的错误只是提到无法找到该文件,DownloadFileAsync需要一个文件流,如果不存在,则会出现错误...

实现日志系统的任何想法都可以通过将日志文件发布到FTP中的参数来激活?

您可以使用多个开源项目,例如ExceptionReporter

答案 1 :(得分:0)

在sysadmin使用服务器配置后,这个问题似乎消失了,我不确定到底做了什么。