我有一段代码用于获取
HTTP GET
响应,如下所示:private void ResponseReady(IAsyncResult aResult)
{
HttpWebRequest request = aResult.AsyncState as HttpWebRequest;
try
{
this.Dispatcher.BeginInvoke(delegate()
{
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(aResult);
当没有连接时,程序会停留在response
行并且不会捕获异常。这是因为Dispatcher.Invoke
的原因吗?