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?
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.