c# - ADO.Net Entity Framework ,数据读取期间遇到 fatal error

标签 c# mysql entity-framework mysql-connector

在将 MySql 与 Entity Framework 一起使用时,我收到以下错误。我已将 EntityConnectionStringBuilder 的连接字符串的默认连接超时设置为 300000。如何在 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 Entity Framework 设置 net_read_timeout?

最佳答案

像这样

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

关于c# - ADO.Net Entity Framework ,数据读取期间遇到 fatal error ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12075506/

相关文章:

c# - 无法从 android 中使用 WCF 方法

c# - 我们可以在 C# 中创建一个异常类来推断异常类型并相应地显示相关信息吗?

MySQL - BETWEEN 子句无法与 DATETIME 一起正常工作

php - Laravel 5.3 不同的计数,使用 Eloquent 而不是查询生成器

c# - Entity Framework MappingException : The type 'XXX has been mapped more than once

entity-framework - 转换时我得到 LINQ to Entities Int32 ToInt32(System.String)

c# - 运行时如何生成随机数?

c# - 读取和写入剪贴板

mysql - 在连接表上有条件的内部连接

asp.net-mvc - 找不到System.Data.Entity.DataBase