Is it normal to use LocalDb in production?

Stan picture Stan · Nov 26, 2012 · Viewed 16.2k times · Source

I know that using LocalDb is very good and easy for developement, I wonder if it's good idea to use it in production when I host websites on IIS server?

I'm asking because I wonder if it won't have any kind of speed issues in production.

This is my connection string that I want to use in production

Server=(LocalDB)\\v11.0;Integrated Security=SSPI;MultipleActiveResultSets=true;
AttachDBFilename=|DataDirectory|ProjectDB.mdf;

Answer

Krzysztof Kozielczyk picture Krzysztof Kozielczyk · Nov 26, 2012

LocalDB is absolutely supported in production. From the performance point of view it is identical to SQL Server Express, as they share the same database engine.

Now, for a site running in full IIS I would recommend using service-based instance of SQL Server Express. Since IIS is running as a service it is best to have a service-hosted database as well. That means you should not be using User Instance=true or AttachDbFileName=... in your connection string.

If you want to learn more, I recommend this post on using LocalDB from full IIS, part 1 and its follow up, part 2. They go into more details.