ADO.Net Entity framework, Fatal error encountered during data read

假如想象 提交于 2020-01-06 19:36:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!