我试过这个代码在一个正常的C#应用程序,它工作正常。在monodroid中,当我尝试以任何方式从流(或基本流)读取时,它完全错误(换句话说,甚至没有尝试捕获工作)。请帮助:Monodroid WebRequest炸弹应用程序
try
{
WebRequest request = WebRequest.Create(string.Format("http://maps.google.com/maps/geo?q={0},{1}&output=xml&sensor=false", "35.245619","-98.276369"));
WebResponse wresponse = request.GetResponse();
using (StreamReader sr = new StreamReader(wresponse.GetResponseStream()))
{
RunOnUiThread(() => _debug.Text = (sr.ReadToEnd()).ToString());
}
wresponse.Close();
}
catch (Exception ex)
{
RunOnUiThread(() => _debug.Text = string.Format("Exception: ", ex.Message));
}
_debug是我的UI一个TextView对象。