kosnkov
kosnkov

Reputation: 5941

Connection to db lost after some time

after login to my application and waiting some time like half and hour, somehow connection to db thrue entity framework is lost and I got this massage.

You must call the "WebSecurity.InitializeDatabaseConnection" method before you call any other method

Is there anything I could do ?

Upvotes: 1

Views: 156

Answers (1)

Peter Pei Guo
Peter Pei Guo

Reputation: 7870

Two things:

  1. configure timeouts of your database. For example, if you use MySQL, you can configure wait_timeout and interactive_timeout etc. Other databases have similar configurations.
  2. Your application should handle timeout and reconnect. It is the right thing for database to timeout idle sessions, so that resources can be released and to used by active sessions.

Upvotes: 1

Related Questions