I got a question from a customer about the AutoClose property being true on their CMS database that is created whenever they create a new EPiServer project in Visual Studio. A quick Google search reveals why they brought the topic up:
- http://sqlmag.com/blog/worst-practice-allowing-autoclose-sql-server-databases
- http://blogs.msdn.com/b/buckwoody/archive/2009/06/24/sql-server-best-practices-autoclose-should-be-off.aspx
- http://www.sqlserver-dba.com/2013/06/sql-auto-close-keep-it-turned-off.html
So why would EPiServer default to setting this property to true? The answer: LocalDB.
- http://blogs.msdn.com/b/sqlexpress/archive/2008/02/22/sql-express-behaviors-idle-time-resources-usage-auto-close-and-user-instances.aspx
- http://stackoverflow.com/questions/27506649/how-to-prevent-localdb-from-detaching-mdf-file-after-some-idle-time
- http://stackoverflow.com/questions/14153509/how-to-prevent-sql-server-localdb-auto-shutdown
EPiServer does not actually set AutoClose to true. It is just how a new database is created in LocalDB. That is what seems to work best for a new, local web project in general, not just EPiServer projects.
You should definitely turn AutoClose off as soon as:
- You decide to move your database off of SQL Express/LocalDB
- Multiple people have to use your database (more details here)