1

I have following connection string:

metadata=res:///Database.csdl|res:///Database.ssdl|res://*/Database.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename='Database.mdf';Integrated Security=True;User Instance=True;Connection Timeout=300;"

I expect that this connection string can never get timeout (because it is 5 mins). However, on a very easy database.table.Count() call to Entity Framework it fails in 10 seconds with "Timeout" exception. Why does Entity Framework ignores SQL timeout? How to set timeout for Entity Framework?

1

2 Answers 2

3

Connection timeout specifies the amount of time to spend waiting for a connection. It doesn't affect the amount of time that a query can spend before timing out.

For that, you need to search for a CommandTimeout property on whatever database context class you're using.

Sign up to request clarification or add additional context in comments.

Comments

0

Connection Timeout is the amount of time to wait whilst attempting to connect to the DB server not executing a query

Comments

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.