首页 文章

Web请求突然停止工作[关闭]

提问于
浏览
0

我正在开发一个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):at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task)[0x00026] in:0 03-24 21:29:44.062 E / mono(9248):at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task)[0x00028] in:0 03-24 21:29:44.062 E / mono(9248):at System . Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task 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):at 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):at System.Runtime.CompilerServices.Ta skAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x0001a] in:0 03-24 21:29:44.062 E / mono(9248):at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks .Task任务)[0x00028] in:0 03-24 21:29:44.062 E / mono(9248):at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task 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):at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task)[0x00028] in:0 03-24 21:29:44.062 E / mono(9248):at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task 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):at SocialNetwork.LoginPage d__2 .MoveNext()[0x000a1]在C:\ Users \ Jacob \ OneDrive \ Documents \ Visual Studio \ SocialMedia \ SocialNetwork \ SocialNetwork \ LoginPage.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):at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuc cess(System.Threading.Tasks.Task任务)[0x0001a] in:0 03-24 21:29:44.062 E / mono(9248):at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务)[0x00028] in:0 03-24 21:29:44.062 E / mono(9248):at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task task)[0x00008] in:0 03 -24 21:29:44.062 E / mono(9248):在System.Runtime.CompilerServices.TaskAwaiter.GetResult()[0x00000] in:0 03-24 21:29:44.062 E / mono(9248):在SocialNetwork . 登录页面d _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(包装器动态方法)System.Object.b3fe65b9-9c99-495b-aeb4-4948b63ae737(intptr,intptr)03-24 21:29:44.082 E / mono-rt(9248):[ERROR]致命未处理EXCEPTION:System.Threading.Tasks.TaskCanceledException:任务已取消 . 03-24 21:29:44.082 E / mono-rt(9248):在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x00026] in:0 03-24 21:29: 44.082 E / mono-rt(9248):at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task 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.TaskAwaiter1 [TResult] .GetResult()[0x00000] in:0 03-24 21:29:44.082 E / mono-rt(9248):at 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):at System.Runt ime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task)[0x0001a] in:0 03-24 21:29:44.082 E / mono-rt(9248):at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task任务)[0x00028] in:0 03-24 21:29:44.082 E / mono-rt(9248):at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks . 任务任务)[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):at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()[0x0000c] in:0 03-24 21:29:44.082 E / mono-rt(9248):at System.Runtime.CompilerServices.Task Awaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x0001a] in:0 03-24 21:29:44.082 E / mono-rt(9248):at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading .Tasks.Task任务)[0x00028] in:0 03-24 21:29:44.082 E / mono-rt(9248):at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task task)[ 0x00008] in:0 03-24 21:29:44.082 E / mono-rt(9248):at System.Runtime.CompilerServices.TaskAwaiter1 [TResult] .GetResult()[0x00000] in:0 03-24 21:29: 44.082 E / mono-rt(9248):在SocialNetwork.LoginPage d__2.MoveNext()[0x000a1]在C:\ Users \ Jacob \ OneDrive \ Documents \ Visual Studio \ SocialMedia \ SocialNetwork \ SocialNetwork \ LoginPage.xaml.cs:36 03-24 21:29:44.082 E / mono-rt(9248):---从抛出异常的前一个位置开始的堆栈追踪结束--- 03-24 21:29:44.082 E / mono-rt(9248) :at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()[0x0000c] in:0 03-24 21:29:44.082 E / mono-rt(924 8):在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x0001a] in:0 03-24 21:29:44.082 E / mono-rt(9248):at System.Runtime .CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task)[0x00028] in:0 03-24 21:29:44.082 E / mono-rt(9248):at 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.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(intpt R,IntPtr的)

1 回答

  • 0

    问题出现在我的后端 .

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

相关问题