Geo*_*ge2 46 .net c# asp.net ado.net sql-server-2005
如果连接字符串Trusted_Connection=true
使用SQL Server身份验证模式指定,我的Web应用程序的性能是否会受到影响?
mar*_*c_s 129
不是100%肯定你的意思:
Trusted_Connection=True;
Run Code Online (Sandbox Code Playgroud)
IS使用的是Windows凭据,相当于100%:
Integrated Security=SSPI;
Run Code Online (Sandbox Code Playgroud)
要么
Integrated Security=true;
Run Code Online (Sandbox Code Playgroud)
如果您不想使用集成安全性/可信连接,则需要在连接字符串中明确指定用户标识和密码(并省略对Trusted_Connection
or的任何引用Integrated Security
)
server=yourservername;database=yourdatabase;user id=YourUser;pwd=TopSecret
Run Code Online (Sandbox Code Playgroud)
仅在这种情况下,使用SQL Server身份验证模式.
如果存在(Trusted_Connection=true
或Integrated Security=true/SSPI
)这两个设置中的任何一个,则使用当前用户的Windows凭据对SQL Server进行身份验证,并且user iD=
将忽略并且不使用任何设置.
有关参考,请参阅SQL Server 2005 的连接字符串站点,其中包含大量示例和说明.
使用Windows身份验证是首选和推荐的处理方式,但由于SQL Server必须针对Active Directory(通常)对您的凭据进行身份验证,因此可能会稍有延迟.我不知道那可能会有多少延迟,我也没有找到任何参考.
加起来:
如果指定连接字符串中的一个Trusted_Connection=True;
或Integrated Security=SSPI;
或Integrated Security=true;
==> 那么(并且只有这样)你发生了Windows身份验证.user id=
连接字符串中的任何设置都将被忽略.
如果您不指定其中任何一个设置,
==>然后你没有发生Windows身份验证(将使用SQL身份验证模式)
当您使用可信连接时,用户名和密码是IGNORED,因为SQL Server使用Windows身份验证.