天天看點

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