码迷,mamicode.com
首页 > 其他好文 > 详细

try里Response.end()问题

时间:2017-05-12 01:45:48      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:解决   msdn   rar   cat   complete   end   font   text   ros   

问题

在xxx.aspx.cs中处理异步请求,大致代码如下:

技术分享

但会发现始终会进catch。

 

原因

Response.End()会引发ThreadAbortException。

 

解决方案

使用HttpContext.Current.ApplicationInstance.CompleteRequest();代替

 

参考

官方文档:https://msdn.microsoft.com/zh-cn/library/system.web.httpresponse.end.aspx

博客园:https://q.cnblogs.com/q/31506/

stackoverflow:http://stackoverflow.com/questions/20988445/how-to-avoid-response-end-thread-was-being-aborted-exception-during-the-exce

try里Response.end()问题

标签:解决   msdn   rar   cat   complete   end   font   text   ros   

原文地址:http://www.cnblogs.com/talentzemin/p/6843374.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!