ADO.Net实体框架,在数据读取期间遇到致命错误 [英] ADO.Net Entity framework, Fatal error encountered during data read
本文介绍了ADO.Net实体框架,在数据读取期间遇到致命错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用MySql与Entity框架时,我收到以下错误。我将EntityConnectionStringBuilder的连接字符串的默认连接超时设置为300000。如何在实体框架中解决这个问题?
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.
更新:我们如何为ado.net实体框架设置net_read_timeout?
Update: How can we set net_read_timeout for ado.net entity framework?
推荐答案
像这样
data.Database.ExecuteSqlCommand("set net_write_timeout=99999; set net_read_timeout=99999");
这篇关于ADO.Net实体框架,在数据读取期间遇到致命错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文