网络请求突然停止工作

时间:2018-03-25 04:34:16

标签: c# xamarin xamarin.forms

我正在开发一个Xamarin.Forms PCL项目,该项目使用Web请求来记录用户。自从我几个月前创建应用程序以来它一直运行良好但突然今天它停止工作我没有改变登录代码中的任何内容。

使用

运行Web请求
var values = new Dictionary<string, string>
{
    {"username", username },
    {"password", password }
};

var content = new FormUrlEncodedContent(values);
var response = await App.client.PostAsync(App.URL + "account.php", content);
var responseString = await response.Content.ReadAsStringAsync();
string page_result = responseString;

进入休息模式并说

  

System.Threading.Tasks.TaskCanceledException:任务被取消。

当我按下运行Web请求的按钮时,输出显示

  

03-24 21:29:44.062 E / mono(9248):未处理的异常:   03-24 21:29:44.062 E / mono(9248):System.Threading.Tasks.TaskCanceledException:任务被取消。   03-24 21:29:44.062 E / mono(9248):在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x00026] in:0   03-24 21:29:44.062 E / mono(9248):在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务)[0x00028] in:0   03-24 21:29:44.062 E / mono(9248):在System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x00008] in:0   03-24 21:29:44.062 E / mono(9248):at System.Runtime.CompilerServices.TaskAwaiter`1 [TResult] .GetResult()[0x00000] in:0   03-24 21:29:44.062 E / mono(9248):在System.Net.Http.HttpClientHandler + d__64.MoveNext()[0x004f5] in:0   03-24 21:29:44.062 E / mono(9248):---从抛出异常的上一个位置开始的堆栈跟踪结束---   03-24 21:29:44.062 E / mono(9248):在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()[0x0000c] in:0   03-24 21:29:44.062 E / mono(9248):在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x0001a] in:0   03-24 21:29:44.062 E / mono(9248):在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务)[0x00028] in:0   03-24 21:29:44.062 E / mono(9248):在System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x00008] in:0   03-24 21:29:44.062 E / mono(9248):at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1 + ConfiguredTaskAwaiter [TResult] .GetResult()[0x00000] in:0   03-24 21:29:44.062 E / mono(9248):在System.Net.Http.HttpClient + d__49.MoveNext()[0x000ca] in:0   03-24 21:29:44.062 E / mono(9248):---从抛出异常的上一个位置开始的堆栈跟踪结束---   03-24 21:29:44.062 E / mono(9248):在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()[0x0000c] in:0   03-24 21:29:44.062 E / mono(9248):在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x0001a] in:0   03-24 21:29:44.062 E / mono(9248):在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务)[0x00028] in:0   03-24 21:29:44.062 E / mono(9248):在System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x00008] in:0   03-24 21:29:44.062 E / mono(9248):at System.Runtime.CompilerServices.TaskAwaiter1 [TResult] .GetResult()[0x00000] in:0   03-24 21:29:44.062 E / mono(9248):在C:\ Users \ Jacob \ OneDrive \ Documents \ Visual Studio \ SocialMedia \ SocialNetwork \ SocialNetwork \ LoginPage中的SocialNetwork.LoginPage + d__2.MoveNext()[0x000a1] .xaml.cs:36   03-24 21:29:44.062 E / mono(9248):---从抛出异常的上一个位置开始的堆栈跟踪结束---   03-24 21:29:44.062 E / mono(9248):在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()[0x0000c] in:0   03-24 21:29:44.062 E / mono(9248):在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x0001a] in:0   03-24 21:29:44.062 E / mono(9248):在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务)[0x00028] in:0   03-24 21:29:44.062 E / mono(9248):在System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x00008] in:0   03-24 21:29:44.062 E / mono(9248):在System.Runtime.CompilerServices.TaskAwaiter.GetResult()[0x00000]中:0   03-24 21:29:44.062 E / mono(9248):在SocialNetwork.LoginPage + d _1.1.MoveNext()[0x0002c]在C:\ Users \ Jacob \ OneDrive \ Documents \ Visual Studio \ SocialMedia \ SocialNetwork \ SocialNetwork \ LoginPage .xaml.cs:23   03-24 21:29:44.062 E / mono(9248):---从抛出异常的上一个位置开始的堆栈跟踪结束---   03-24 21:29:44.062 E / mono(9248):at(wrapper dynamic-method)System.Object.b3fe65b9-9c99-495b-aeb4-4948b63ae737(intptr,intptr)   03-24 21:29:44.082 E / mono-rt(9248):[ERROR]致命不受限制异常:System.Threading.Tasks.TaskCanceledException:任务被取消。   03-24 21:29:44.082 E / mono-rt(9248):at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task)[0x00026] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务)[0x00028] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x00008] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.CompilerServices.TaskAwaiter1 [TResult] .GetResult()[0x00000] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Net.Http.HttpClientHandler + d__64.MoveNext()[0x004f5] in:0   03-24 21:29:44.082 E / mono-rt(9248):---从抛出异常的前一个位置开始的堆栈跟踪结束---   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()[0x0000c] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x0001a] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务)[0x00028] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x00008] in:0   03-24 21:29:44.082 E / mono-rt(9248):at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1 + ConfiguredTaskAwaiter [TResult] .GetResult()[0x00000] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Net.Http.HttpClient + d__49.MoveNext()[0x000ca] in:0   03-24 21:29:44.082 E / mono-rt(9248):---从抛出异常的前一个位置开始的堆栈跟踪结束---   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()[0x0000c] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x0001a] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务)[0x00028] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x00008] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.CompilerServices.TaskAwaiter1 [TResult] .GetResult()[0x00000] in:0   03-24 21:29:44.082 E / mono-rt(9248):在C:\ Users \ Jacob \ OneDrive \ Documents \ Visual Studio \ SocialMedia \ SocialNetwork \ SocialNetwork中的SocialNetwork.LoginPage + d__2.MoveNext()[0x000a1] \ LoginPage.xaml.cs:36   03-24 21:29:44.082 E / mono-rt(9248):---从抛出异常的前一个位置开始的堆栈跟踪结束---   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()[0x0000c] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x0001a] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务)[0x00028] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x00008] in:0   03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.CompilerServices.TaskAwaiter.GetResult()[0x00000] in:0   03-24 21:29:44.082 E / mono-rt(9248):在SocialNetwork.LoginPage + d _1.1.MoveNext()[0x0002c]在C:\ Users \ Jacob \ OneDrive \ Documents \ Visual Studio \ SocialMedia \ SocialNetwork \ SocialNetwork \ LoginPage.xaml.cs:23   03-24 21:29:44.082 E / mono-rt(9248):---从抛出异常的前一个位置开始的堆栈跟踪结束---   03-24 21:29:44.082 E / mono-rt(9248):at(wrapper dynamic-method)System.Object.b3fe65b9-9c99-495b-aeb4-4948b63ae737(intptr,intptr)

1 个答案:

答案 0 :(得分:0)

问题出现在我的后端。

我尝试直接在浏览器中连接到我的数据库,并意识到登录已更新。