2011-11-27 835 views
14

我在我的项目中使用elmah - >Elmah.axd来查找错误。
有类似这样的错误:远程主机关闭连接错误,怎么修复?

System.Web.HttpException: The remote host closed the connection. The error code is 0x800703E3. 
Generated: Sun, 27 Nov 2011 13:06:13 GMT 

System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Web.HttpException (0x800703E3): The remote host closed the connection. The error code is 0x800703E3. 
    at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect) 
    at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush() 
    at System.Web.HttpResponse.Flush(Boolean finalFlush) 
    at System.Web.HttpWriter.TransmitFile(String filename, Int64 offset, Int64 size, Boolean isImpersonating, Boolean supportsLongTransmitFile) 
    at System.Web.HttpResponse.TransmitFile(String filename, Int64 offset, Int64 length) 
    at SalarSoft.Utility.SP1.ResumeDownload.ProcessDownload(String fileName, String headerFileName) 
    at NiceFileExplorer.en.Download.DownloadFile_SalarSoft(String fileName) 
    at NiceFileExplorer.en.Download.GoForDownloadFile(String filepath) 
    at NiceFileExplorer.en.Download.MainCodes() 
    at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) 
    at System.Web.UI.Control.LoadRecursive() 
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
    at System.Web.UI.Page.HandleError(Exception e) 
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
    at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
    at System.Web.UI.Page.ProcessRequest() 
    at System.Web.UI.Page.ProcessRequest(HttpContext context) 
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 

与网站工作的过程中,我们没有看到这个错误。
但elmah多次向我发送此错误。
这个错误意味着什么,我该如何解决它?

编辑1
{我的网站是立即下载移动文件和某些时候,它真的很忙}
{我使用的Windows Server 2008 [2->远程访问}评论后

EDIT 2
一些窗口的信息和警告(没有错误)今天日志象下面这样:

警告

服务应用程序池“ASP.NET 4.0(Integrated)”的进程在关闭期间超过了 时间限制。进程ID是'6764'。

警告

的工作进程 '3232' 服务应用程序池ASP.NET 4.0 (集成)'失败在 停协议的听者信道的 'http' 所分配的时间。数据字段包含错误编号。

警告

进程服务应用程序池 'ASP.NET 4.0(集成)' 关闭过程中超出 时间限制。进程ID是'3928'。

+0

您需要找出远程主机关闭连接的原因。 –

+0

你将不得不在服务器上看。例如,服务器上的Windows事件日志;也许是IIS日志。 –

+0

@John Saunders嗨,感谢评论,PLZ看到我编辑2. – MoonLight

回答

23

我在我建立的网站的日志中看到了很多。

AFAIK异常意味着客户端在页面加载完成之前断开连接(转到另一页/关闭浏览器)。如果客户端正在下载文件,这个错误更可能是因为他们有更多时间来决定退出/继续。

该错误对用户不可见* - 所以我刚刚将它从Elmah日志中删除。

*该网站只允许通过身份验证的用户。我能从Elmah看到谁经历过错误和何时。我已经询问了用户,并且没有一个人有曾报告报告在客户端遇到此错误。

+0

嗨尼尔,所以没有什么可担心的。我说得对吗? – MoonLight

+0

是的。完全不用担心。 –

+0

@NeilThompson,你能隐藏Elmah的这种错误吗? – eduardobr

2

今天我遇到了这个问题,对我而言,这是因为套接字超时等待远程端发送。

在这个例子中,一个非常(或故意)慢的客户端可能会导致异常。

我选择通过增加套接字上的接收超时来解决它,因为我想支持一些特定的较慢客户端,这些客户端因高SSL需求而被征税。

0

对这次派对迟了一点,但如果它帮助别人,Response.Close()在我的情况下导致异常。

我看到了由El描述的异常,由Elmah捕获。

这是存在的由于闭合响应(I被支撑所述代码被写入到响应输出流):

Response.Flush(); 
Response.Close(); 
Response.End(); 

卸下Response.Close();停止被引发的异常。

2

我在用户取消文件下载时遇到了该错误。在服务器端,它产生一个异常信息远程主机关闭了连接。错误代码是0x800703E3。但是,该异常没有任何可以分开处理的不同类型。

在odrer处理它在ASP.NET MVC正确我添加了一个例外记录:

public static class RegisterFilters 
{ 
    public static void Execute(HttpConfiguration configuration) 
    { 
     configuration.Services.Add(typeof(IExceptionLogger), new WebExceptionLogger()); 
    } 
} 

而且WebExceptionLogger类实现:

public class WebExceptionLogger : ExceptionLogger 
{ 
    private const int RequestCancelledByUserExceptionCode = -2147023901; 

    public override void Log(ExceptionLoggerContext context) 
    { 
     var dependencyScope = context.Request.GetDependencyScope(); 
     var loggerFactory = dependencyScope.GetService(typeof(ILoggerFactory)) as ILoggerFactory; 
     if (loggerFactory == null) 
     { 
      throw new IoCResolutionException<ILoggerFactory>(); 
     } 

     var logger = loggerFactory.GetTechnicalLogger<WebExceptionLogger>(); 
     if (context.Exception.HResult == RequestCancelledByUserExceptionCode) 
     { 
      logger.Info($"Request to url {context.Request.RequestUri} was cancelled by user."); 
     } 
     else 
     { 
      logger.Error("An unhandled exception has occured", context.Exception); 
     } 
    } 
} 

我注意到,这specifict错误类型具有的HResult = -2147023901,所以这就是我要过滤的内容。

希望这会有所帮助。

相关问题