接受的方式来防止“远程主机关闭连接”例外 [英] Accepted way to prevent "The remote host closed the connection" exception

查看:121
本文介绍了接受的方式来防止“远程主机关闭连接”例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不断获得下列异常,这是由用户启动下载引起的,因此导致失败(或被取消):

I'm constantly getting the following exception which is caused by a user initiating a download and it consequently failing (or being cancelled):

错误消息:远程主机关闭
连接。错误代码是
0x80072746。堆栈跟踪:at
System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6.FlushCore(Byte []
status,Byte []头,Int32
keepConnected,Int32 totalBodySize,
Int32 numBodyFragments,IntPtr []
bodyFragments,Int32 []
bodyFragmentLengths,Int32
doneWithSession,Int32 finalStatus,
Boolean& async)
System.Web.Hosting.ISAPIWorkerRequest.FlushCachedResponse Boolean
isFinal)at
System.Web.Hosting.ISAPIWorkerRequest.FlushResponse(Boolean
finalFlush)at

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.

我讨厌说这个,但是我很想检查这个异常,空的catch阻止了它的屁股 - 但这让我感觉像一个肮脏的程序员。

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.

所以 - 阻止这个异常填写我的邮箱的接受方法是什么?

推荐答案

你不能防止远程主机关闭任何东西。

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.

这篇关于接受的方式来防止“远程主机关闭连接”例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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