简体   繁体   English

调试时如何避免“任务被取消”

[英]How to Avoid “A task was cancelled” when debugging

When debugging async services, in Visual Studio 2017, frequently the calling app somehow times out and returns "A Task was cancelled" error - when really I'm just taking too long debugging. 在调试异步服务时,在Visual Studio 2017中,调用应用程序经常以某种方式超时并返回“任务已取消”错误-实际上我只是花了太长时间调试。

Is there any way to extend the timeout or suspend cancelling tasks when debugging? 调试时是否有延长超时或暂停取消任务的方法?

I'm running a web app, async calling a separate rest service. 我正在运行一个Web应用程序,异步调用一个单独的Rest服务。 Two visual studio solutions open, debugging from the web app solution steps straight into the other solution no problem - but the first solution raises the "Task Cancelled" error after about 5 minutes. 打开了两个Visual Studio解决方案,从Web应用程序解决方案进行调试直接进入另一个解决方案没有问题-但是第一个解决方案在大约5分钟后引发了“任务已取消”错误。

In your web.config, make sure you have the following fields: 在您的web.config中,确保您具有以下字段:

<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1" executionTimeout="1" />

Small explanation, the executionTimeout is by seconds and will only work if debug=false, if the debug in compilation is true then the executionTimeout is useless and it becomes max. 小小的解释,executionTimeout是几秒钟,仅当debug = false时才有效,如果编译中的调试为true,则executeTimeout是无用的,并且变为max。 Check the following answer for further explaining. 检查以下答案以进一步解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM