远程服务器返回错误未找到

时间:2014-08-04 14:15:34

标签: windows-phone-7 windows-phone-8

我在foreach

中在服务器上创建get请求
foreach (ulong id in IDList)
        GetData(Convert.ToInt32(id));

我的要求:

public void GetData(int id)
        {
            string url = String.Format(GET_URL, id);
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "Get";
            request.CookieContainer = _cookies;
            request.BeginGetResponse(new AsyncCallback(ReadCallbackData), request);
        }

我的回答我得到异常:"远程服务器返回错误未发现"

      private void ReadCallbackData(IAsyncResult asynchronousResult)
            {
                try
                {   HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;
                    HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asynchronousResult);
                   }

    catch(Exception ex)
    {}     
}      

当我在模拟器上测试时,我没有得到此异常,仅在设备上和我有很多ID时。当我有5-10 ID时,我也没有得到这个例外

0 个答案:

没有答案