在C#中从mysql连接超时

问题描述:

如何解决连接超时过期的错误。从池中获取连接之前已经过了超时时间。这可能是因为所有池连接都在使用并且达到了最大池大小



什么我试过了:



MySqlConnection conn = new MySqlConnection();

conn.ConnectionString =server = 192.168.100.180 ; user = rks; database = test; port = 3306; password = 1234;;

conn.Open();

cmd.CommandTimeout = 600;

how to solve error connecting timeout expired. the timeout period elapsed prior to obtaining a connection from the pool.this may have occurred decause all pooled connections were in use and max pool size was reached

What I have tried:

MySqlConnection conn = new MySqlConnection();
conn.ConnectionString = "server=192.168.100.180;user=rks;database=test;port=3306;password=1234;";
conn.Open();
cmd.CommandTimeout = 600;

尝试释放您的连接,并阅读:

MySQL :: MySQL Connector / Net开发人员指南:: 5.4使用带连接池的连接器/网络 [ ^ ]

使用MySQL的C#中的最大池大小错误 - Stack Overflow [ ^ ]
Try releasing your connections, and read this :
MySQL :: MySQL Connector/Net Developer Guide :: 5.4 Using Connector/Net with Connection Pooling[^]
Maximum pool size error in C# using MySQL - Stack Overflow[^]


MySqlConnection conn = new MySqlConnection();
conn.ConnectionString = "server=192.168.100.180;user=rks;database=test;port=3306;password=1234;";
conn.Open();
MySqlDataReader rdr = cmd1.ExecuteReader();
cmd.CommandTimeout = 600; 

rdr.Close();
connn.Close();