我经常得到下面的异常,这是由用户启动下载引起的,因此导致失败(或被取消):
错误消息:远程主机关闭了连接。 错误代码是0x80072746。 堆栈跟踪:在System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6.FlushCore(字节[]状态,字节[]标题,Int32 keepConnected,Int32 totalBodySize,Int32 numBodyFragments,IntPtr [] bodyFragments,Int32 [] bodyFragmentLengths,Int32 doneWithSession,Int32 finalStatus,布尔&异步)在System.Web.Hosting.ISAPIWorkerRequest.FlushCachedResponse(布尔isFinal)在System.Web.Hosting.ISAPIWorkerRequest.FlushResponse(布尔finalFlush)at
我在互联网上搜索了所有内容, 并找到了一篇有趣的文章 ,但似乎并没有明确的答案,因为这是防止填充日志的最佳方法。
用户看到没有错误,并且应用程序中没有实际问题,因为它仅在(在我的理解中)出现在不受控制的情况下(用户取消下载或连接丢失),但必须有防止出现此类异常的方法报道。
我讨厌这样说,但我很想去检查这个异常,并且空的catch将它的屁股剔除 - 但这让我觉得自己像个脏兮兮的程序员。
那么 - 防止这个异常填满我的邮箱的方法是什么?
I'm constantly getting the following exception which is caused by a user initiating a download and it consequently failing (or being cancelled):
Error Message : The remote host closed the connection. The error code is 0x80072746. Stack Trace : at System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6.FlushCore(Byte[] status, Byte[] header, Int32 keepConnected, Int32 totalBodySize, Int32 numBodyFragments, IntPtr[] bodyFragments, Int32[] bodyFragmentLengths, Int32 doneWithSession, Int32 finalStatus, Boolean& async) at System.Web.Hosting.ISAPIWorkerRequest.FlushCachedResponse(Boolean isFinal) at System.Web.Hosting.ISAPIWorkerRequest.FlushResponse(Boolean finalFlush) at
I've searched all over the internet, and found an interesting article, however there doesn't seem to be a definitive answer as the best way to prevent this filling up the logs.
The user sees no error and there's no actual problem in the app as it occurs only (to my understanding) in situations out of its control (user cancelling download or loss of connection) but there has to be a way to prevent such an exception being reported.
I hate to say it but I'm tempted to check for this exception and empty catch block its ass away - but this makes me feel like a dirty programmer.
So - what is the accepted method of preventing this exception filling up my mailbox?
最满意答案
您无法阻止远程主机关闭任何内容。
在一些协议中,这是说再见的正常(或至少被接受)的方式。
所以你将不得不处理这个特定的异常。
You cannot prevent a remote Host to close anything.
And in some protocols this is the normal (or at least accepted) way to say goodbye.
So you will have to handle this specific exception.
更多推荐
发布评论