问题
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?
回答1:
Like this
data.Database.ExecuteSqlCommand("set net_write_timeout=99999; set net_read_timeout=99999");
回答2:
what does the inner exception say?
Unhandled Exception: System.Data.EntityCommandExecutionException does not point to a timeout error, it could be something as simple as an int that needs to be nullable that is used in your EF query.
Could you give the query to?
Cheers
来源:https://stackoverflow.com/questions/12075506/ado-net-entity-framework-fatal-error-encountered-during-data-read