使用Trusted_Connection = true和SQL Server身份验证时,这会影响性能吗? [英] When using Trusted_Connection=true and SQL Server authentication, will this affect performance?
问题描述
如果连接字符串在SQL Server身份验证模式下指定 Trusted_Connection = true
,是否会影响我的Web应用程序的性能?
If a connection string specifies Trusted_Connection=true
with SQL Server authentication mode, will performance of my web application be impacted?
推荐答案
不确定100%的意思:
Not 100% sure what you mean:
Trusted_Connection=True;
IS 使用Windows凭据,并且100%等效于:
IS using Windows credentials and is 100% equivalent to:
Integrated Security=SSPI;
或
Integrated Security=true;
如果您不想使用集成安全性/可信连接,则需要指定用户ID和密码在连接字符串中显式显示(并保留对 Trusted_Connection
或 Integrated Security
的任何引用)
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
仅在这种情况下,才使用SQL Server身份验证模式。
Only in this case, the SQL Server authentication mode is used.
如果存在这两个设置( Trusted_Connection = true
或 Integrated Security = true / SSPI
),然后输入 Windows凭据当前用户用于对SQL Server进行身份验证,并且任何用户iD =
设置都将被忽略,并且不被使用。
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.
有关参考,请参见 SQL Server的连接字符串站点 2005年es和说明。
For reference, see the Connection Strings site for SQL Server 2005 with lots of samples and explanations.
使用Windows身份验证是首选方法,但由于SQL Server必须针对Active身份验证您的凭据,因此可能会稍有延迟。目录(通常)。我不知道这种轻微的延迟可能有多少,而且我还没有找到任何参考。
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.
总结:
如果您指定 Trusted_Connection = True;
或 Integrated Security = SSPI;
或 Integrated Security = true;
在您的连接字符串中
If you specify either Trusted_Connection=True;
or Integrated Security=SSPI;
or Integrated Security=true;
in your connection string
==> 之后(只有那时),您会发生 Windows身份验证。连接字符串中的任何用户ID =
设置都将被忽略。
==> 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,
==>则您执行不是正在执行Windows身份验证(将使用SQL身份验证模式)
==> then you DO NOT have Windows Authentication happening (SQL Authentication mode will be used)
这篇关于使用Trusted_Connection = true和SQL Server身份验证时,这会影响性能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!