使用 Trusted_Connection=true 和 SQL Server 身份验证时,这会影响性能吗?

When using Trusted_Connection=true and SQL Server authentication, will this affect performance?(使用 Trusted_Connection=true 和 SQL Server 身份验证时,这会影响性能吗?)
本文介绍了使用 Trusted_Connection=true 和 SQL Server 身份验证时,这会影响性能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果连接字符串使用 SQL Server 身份验证模式指定 Trusted_Connection=true,我的 Web 应用程序的性能会受到影响吗?

解决方案

不是 100% 确定你的意思:

Trusted_Connection=True;

使用 Windows 凭据并且 100% 等同于:

集成安全=SSPI;

集成安全=true;

如果您不想使用集成安全/可信连接,则需要在连接字符串中明确指定用户 ID 和密码(并省略对 Trusted_ConnectionIntegrated 的任何引用安全)

server=yourservername;database=yourdatabase;user id=YourUser;pwd=TopSecret

仅在这种情况下,使用 SQL Server 身份验证模式.

如果存在这两个设置中的任何一个(Trusted_Connection=trueIntegrated Security=true/SSPI),则 Windows 凭据当前用户用于针对 SQL Server 进行身份验证,并且任何 user iD= 设置都将被忽略并且 not 被使用.

有关参考,请参阅 SQL Server 2005 的 连接字符串站点,其中包含大量示例和解释.

使用 Windows 身份验证是首选和推荐的做事方式,但它可能会导致轻微延迟,因为 SQL Server 必须针对 Active Directory 对您的凭据进行身份验证(通常).我不知道这种轻微的延迟可能会有多少,也没有找到任何参考资料.

<小时>

总结:

如果您在连接字符串中指定 Trusted_Connection=True;Integrated Security=SSPI;Integrated Security=true;p>

==> THEN(并且只有在那时)您才会发生 Windows 身份验证.连接字符串中的任何 user id= 设置都将被忽略.

<小时>

如果您指定其中任何一个设置,

==> 那么您不要进行 Windows 身份验证(将使用 SQL 身份验证模式)

<小时>

If a connection string specifies Trusted_Connection=true with SQL Server authentication mode, will performance of my web application be impacted?

解决方案

Not 100% sure what you mean:

Trusted_Connection=True;

IS using Windows credentials and is 100% equivalent to:

Integrated Security=SSPI;

or

Integrated Security=true;

If you don't want to use integrated security / trusted connection, you need to specify user id and password explicitly in the connection string (and leave out any reference to Trusted_Connection or Integrated Security)

server=yourservername;database=yourdatabase;user id=YourUser;pwd=TopSecret

Only in this case, the SQL Server authentication mode is used.

If any of these two settings is present (Trusted_Connection=true or Integrated Security=true/SSPI), then the Windows credentials of the current user are used to authenticate against SQL Server and any user iD= setting will be ignored and not used.

For reference, see the Connection Strings site for SQL Server 2005 with lots of samples and explanations.

Using Windows Authentication is the preferred and recommended way of doing things, but it might incur a slight delay since SQL Server would have to authenticate your credentials against Active Directory (typically). I have no idea how much that slight delay might be, and I haven't found any references for that.


Summing up:

If you specify either Trusted_Connection=True; or Integrated Security=SSPI; or Integrated Security=true; in your connection string

==> THEN (and only then) you have Windows Authentication happening. Any user id= setting in the connection string will be ignored.


If you DO NOT specify either of those settings,

==> then you DO NOT have Windows Authentication happening (SQL Authentication mode will be used)


这篇关于使用 Trusted_Connection=true 和 SQL Server 身份验证时,这会影响性能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)