多线程异步。(多的时候有20多个 ) 调试代码 (打断点10秒不超过30秒)这段代码异常
public static DataTable SqlQueryForDataTatable(string sql, MySqlParameter[] parameters) { using (SysEntities db = new SysEntities()) { MySqlConnection conn = new MySqlConnection(); conn.ConnectionString = db.Database.Connection.ConnectionString; if (conn.State != ConnectionState.Open) { conn.Open(); } MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; if (parameters != null && parameters.Length > 0) { foreach (var item in parameters) { cmd.Parameters.Add(item); } } MySqlDataAdapter adapter = new MySqlDataAdapter(cmd); DataTable table = new DataTable(); adapter.Fill(table); conn.Close(); return table; } }
conn.Open();这个地方 提示 Authentication to host 'xxxxx' for user 'root' using method 'mysql_native_password' failed with message: Reading from the stream has failed
. 不打断点 运行正常 没问题。
Database public Database Database { get; } 是ef的 别人封装的
在那大哥断点,把Database.Connection.ConnectionString拿出来,然后用第三方客户端去登陆不就行了