The remote host closed the connection. The error code is 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
基础教程推荐
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- MS Visual Studio .NET 的替代品 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01