The remote host closed the connection. The error code is 0x80070057

后端 未结 2 913
失恋的感觉
失恋的感觉 2020-12-24 15:45

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 re

2条回答
  •  别那么骄傲
    2020-12-24 16:21

    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();
    

    To this for each individual connection:

    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!

提交回复
热议问题