Is it normal to use LocalDb in production?

前端 未结 3 1744
挽巷
挽巷 2020-12-13 13:53

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?

<
相关标签:
3条回答
  • "Normal" - hard to say, that's a relative term.

    Permitted - yes. Here is a quote from the Microsoft SQL Server Express blog where LocalDB was introduced:

    "...if the simplicity (and limitations) of LocalDB fit the needs of the target application environment, developers can continue using it in production, as LocalDB makes a pretty good embedded database too."


    UPDATE (March 2019)

    After using LocalDB in dozens of production sites for two solid years now, I'll confirm that it works. However, if you need a free multi-user ("shared" in LocalDB terminology) DB, use SQL Server Express instead. LocalDB is not a good multi-user solution. There are MANY obstacles to overcome. I don't have time now, but if you would like details on those obstacles and respective workarounds, leave a comment, and I'll document them here or in another question.

    0 讨论(0)
  • 2020-12-13 14:23

    I don't think so,

    Even though LocalDb and SQLExpress might be the same on performance, LocalDb's Process shuts down itself if it doesn't have any request for a while. And usually the next request takes too long to response (or even worse, it times out).

    I would recommend you install your own instance of SQLEXPRESS.

    0 讨论(0)
  • 2020-12-13 14:35

    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.

    0 讨论(0)
提交回复
热议问题