获取与HTT presponse.End摆脱ThreadAbortException的 [英] Get rid of ThreadAbortException with httpResponse.End

查看:186
本文介绍了获取与HTT presponse.End摆脱ThreadAbortException的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道的一种方式来代替 HTT presponse.End()的东西,不会引发 ThreadAbortException 造成问题的表现?有人建议做一个'HttpContext.Current.ApplicationInstance.CompleteRequest()',但这并不尽一切 HTT presponse.End()确实,如发送缓冲数据到这是一个问题,我的客户端。

Does anyone know of a way to replace httpResponse.End() with something that does not throw a ThreadAbortException causing issues with performance? Someone suggested doing a 'HttpContext.Current.ApplicationInstance.CompleteRequest()', but this doesn't do everything httpResponse.End() does, like sending buffered data to the client which is a problem for me.

推荐答案

首先,我怀疑这是的真正的引发显著的问题。然而,这不是一般的好主意呢?这是例外的滥用,真的。 (IMO,反正。)

Firstly, I doubt that this is really causing significant problems. However, it's not generally a great idea anyway... it's an abuse of exceptions, really. (IMO, anyway.)

文档

时,提供仅用于兼容与ASP - 即,用于与基于COM的Web的编程技术的兼容性是preceded ASP.NET此方法。如果你想提前跳到EndRequest事件并传送到客户端的响应,调用的 CompleteRequest 代替。

This method is provided only for compatibility with ASP—that is, for compatibility with COM-based Web-programming technology that preceded ASP.NET. If you want to jump ahead to the EndRequest event and send a response to the client, call CompleteRequest instead.

显然,目前的方法还是会继续调用后 CompleteRequest ,所以你需要确保你完成当前事件的处理干净。

Obviously the current method will still continue after you call CompleteRequest, so you'll need to make sure you complete the handling of the current event cleanly.

这篇关于获取与HTT presponse.End摆脱ThreadAbortException的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆