0

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?

2 Answers 2

3

Like this

data.Database.ExecuteSqlCommand("set net_write_timeout=99999; set net_read_timeout=99999");
Sign up to request clarification or add additional context in comments.

2 Comments

I'm happy this was helpful to you.
+1 This is magic. It feels like a super hackish magic, but it seems like the only solution for now. (In my case, it was throwing that error on a simple select query of an empty table, so yeah...)
0

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

2 Comments

That's a bug in mysql from what i looked up bugs.mysql.com/bug.php?id=57365 , its due to a timeout
Seems that this is a bug in the mysql connector to do with write timeouts... see stackoverflow.com/questions/6281304/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.