远程主机关闭了连接.错误代码为 0x80070057

The remote host closed the connection. The error code is 0x80070057(远程主机关闭了连接.错误代码为 0x80070057)

本文介绍了远程主机关闭了连接.错误代码为 0x80070057的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的一台服务器上的日志中收到很多此类错误消息,在另外两台服务器上间歇性地收到.

I'm getting a lot of these error messages in my logs on one of my servers and intermittently on two others.

谷歌搜索没有透露太多信息,主要与文件上传或下载被中断有关.

Googling didn't reveal very much information, mostly related to file uploads or downloads being interrupted.

我的页面基本上只是其中带有ok"的文本文件,只有 .aspx 扩展名用于未来计划,没有实际代码为页面提供动力.服务器都是运行 IIS7/ASP.NET 4 的 Windows Server 2008 RC2 x64.

My pages are basically just text files with "ok" in them that only have .aspx extension for future plans, there's no actual code powering the pages. Servers are all Windows Server 2008 RC2 x64 running IIS7 / ASP.NET 4.

从统计上看,发生这种情况的时间远低于 1%,但由于流量仍然使我的事件日志混乱,每分钟有 2 或 3 条此类消息.

Statistically it's happening well under 1% of the time but because of the volume of traffic that still clutters my event log with 2 or 3 of these messages per minute.

我找到了问题,将缓冲设置为 true 阻止了它的发生.

I tracked down the problem, setting buffering to true stopped it occurring.

推荐答案

我知道这已经得到解答,但是如果这对其他人有帮助,它会发生在我的 MVC 项目中,有时我在顶部设置了一个 dbContext的一个存储库.当我切换到数据库连接的 using 语句时,该错误再也没有出现过.

I know this has been answered, but on the off chance this helps someone else, it happened in my MVC project sometimes when I had one dbContext set at the top of a repository. When I switched to a using statement for database connections, the error never appeared again.

所以,我从每个存储库的顶部开始:

So, I went from this at the top of each repository:

DbContext db = new DbContext();

对于每个单独的连接:

using (DbContext db = new DbContext())
{
     //db connection stuff here....
}

值得一提的是,没有人报告过看到错误,也没有向浏览器显示错误,但很高兴将其从日志中删除!

Worth saying that no one ever reported seeing the error and no error was ever shown to the browser, but nice to get it off the logs all the same!

这篇关于远程主机关闭了连接.错误代码为 0x80070057的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:远程主机关闭了连接.错误代码为 0x80070057

基础教程推荐