天天看点

mysql ado.net超时时间,ADO.Net实体框架,在数据读取期间遇到致命错误

mysql ado.net超时时间,ADO.Net实体框架,在数据读取期间遇到致命错误

I am getting the following error while using MySql with Entity framework. I have set the default connection timeout to 300000 on the connection string of EntityConnectionStringBuilder. How to resolve this in Entity framework?

Unhandled Exception: System.Data.EntityCommandExecutionException: An

error occurred while reading from the store provider's data reader. See the

inner exception for details. ---> MySql.Data.MySqlClient.MySqlException: Fatal

error encountered during data read. ---> MySql.Data.MySqlClient.MySqlException:

Reading from the stream has failed. ---> System.IO.EndOfStreamException: Attempted

to read past the end of the stream.

Update: How can we set net_read_timeout for ado.net entity framework?

解决方案

Like this

data.Database.ExecuteSqlCommand("set net_write_timeout=99999; set net_read_timeout=99999");