在生产中使用 LocalDb 是否正常? [英] Is it normal to use LocalDb in production?

查看:30
本文介绍了在生产中使用 LocalDb 是否正常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道使用 LocalDb 非常好并且易​​于开发,我想知道当我在 IIS 服务器上托管网站时在生产中使用它是否是个好主意?

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;

推荐答案

LocalDB 在生产中是绝对支持的.从性能的角度来看,它与 SQL Server Express 相同,因为它们共享相同的数据库引擎.

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.

现在,对于在完整 IIS 中运行的站点,我建议使用基于服务的 SQL Server Express 实例.由于 IIS 作为服务运行,因此最好也有一个服务托管的数据库.这意味着您应该在连接字符串中使用 User Instance=trueAttachDbFileName=....

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.

如果你想了解更多,我推荐这个关于从完整 IIS 使用 LocalDB 的帖子,第 1 部分其跟进,第 2 部分.他们会详细介绍.

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.

这篇关于在生产中使用 LocalDb 是否正常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆