Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# Alternative Strategies for Handling Data Concurrency

EF Timeout after 3 mins

When I run my application and it's about 3 min in the background I am getting this SqlException:

SqlException: Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=15842; handshake=562;

How can I make the Connection last longer to avoid this Exception?

Steven Parker: I tired running it again and everything works as expected even after 10 min of running the application and doing nothing. Maybe my VM was yesterday to slow to respond before EF or something else cut off the connection.

1 Answer

Steven Parker
Steven Parker
230,037 Points

3 minutes is a terribly long time, there's probably some other problem causing it to take so long.

If you show your code or provide a snapshot link, someone might be able to help spot the issue.