简体   繁体   English

连接主机无法在C#Mysql中响应

[英]connection host failed to respond in C# Mysql

What is means of these error in MySQL MySQL中这些错误的含义是什么

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 连接尝试失败,因为一段时间后连接方未正确响应,或者建立连接失败,因为连接的主机未能响应

There is already an open DataReader associated with this Connection which must be closed first. 已经有一个与此连接相关联的打开的DataReader,必须先关闭它。

This error: 这个错误:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Means that your command is trying to fetch data from table. 意味着您的命令正在尝试从表中获取数据。 The table might have a huge amount of data and it can not respond in the time allowed (which you set as timeout in connection string). 该表可能包含大量数据,并且无法在允许的时间内响应(您在连接字符串中将其设置为超时)。

Try the following to solve the issue 请尝试以下解决问题

  1. Make your queries smaller or divide them into parts if possible. 缩小查询范围,或尽可能将其分成几部分。
  2. Increase the command timeout in the connection string on when you open the connection from Mysql server. 从Mysql服务器打开连接时,增加连接字符串中的命令超时。

There is already an open DataReader associated with this Connection which must be closed first. 已经有一个与此连接相关联的打开的DataReader ,必须先关闭它。

It means that your application can open a second connection before the first one closes resulting in an error. 这意味着您的应用程序可以在第一个连接关闭之前打开第二个连接,从而导致错误。

Try any of the following to resolve your issue: 请尝试以下任何一种方法来解决您的问题:

  1. Close the first connection before opening another. 在打开另一个连接之前,请关闭第一个连接。
  2. Allow the MySql server to allow multiple connections. 允许MySql服务器允许多个连接。
  3. Dispose and close the connection when it's no longer of use. 不再使用时,请处置并关闭连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM