本文介绍了验证服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我一直想弄清楚为什么我以[ServerName]/Guest身份登录到SQL Server.我正在尝试连接到数据库并执行一些操作,但是由于以来宾身份登录,这避免了我执行正确的操作.

我的连接字符串曾经是:

CONNECTION_STRING ="服务器= SERVER2 \\ SQLEXPRESS;数据库= RMA_DB; Trusted_Connection = True;"
当我使用它时,我以Guest身份登录,但是当我添加有效的用户名和密码时,我不再以Guest身份登录.我已使用我提供的用户名登录.

因为我的连接字符串是;
CONNECTION_STRING ="服务器= SERVER2 \\ SQLEXPRESS;用户ID = [用户ID];密码= [密码];数据库= RMA_DB; Trusted_Connection = False;"

据我了解,这背后的主要原因是

启用模拟会使ASP.NET以当前运行的用户名的身份向SQL Server发出请求.如果访问该网站的任何人都具有Windows凭据,则可以使用模拟.虽然我正在测试,但是可以,但是当我创建一个人们可以通过Internet访问的网站时,由于用户将没有凭据,因此模拟将不起作用.在这种情况下,我不应该使用模仿.

在我以前使用的另一个Web应用程序中,没有用户名和密码的连接字符串运行良好.我不明白为什么该应用程序无需服务器中的用户名和密码就能连接?

Hello all,

I have been trying to figure out why I am logged as [ServerName]/Guest to the SQL server. I am trying to connect to the db and do some actions but due to being logged as Guest, it is avoiding me to do the proper actions.

My connection string is used to be:

CONNECTION_STRING = "Server=SERVER2\\SQLEXPRESS; Database=RMA_DB; Trusted_Connection=True;"
when I use this I am logged as Guest but when I add a valid user name and a password I am not logged in as Guest anymore. I am logged as a the username that I provided.

for that my connection string is;
CONNECTION_STRING = "Server=SERVER2\\SQLEXPRESS; User Id=[userid]; Password=[password]; Database=RMA_DB; Trusted_Connection=False;"

As far as i know the main reason behind this is;

Enabling impersonation causes ASP.NET to make the request to the SQL Server as the name of the user currently running. Using impersonation works if anyone who hits the site has Windows credentials. While I am testing, that works but when I am going to create a site that people might get to via the Internet, though, then impersonation won''t work, because users won''t have credentials. In that case, I shouldn''t use impersonation.

In another web application that I previously used, the connection string without the username and the password is working perfectly fine tho. What I dont understand why this app can able to connect without the username and password in the server? What I am missing can someone explain?

推荐答案



这篇关于验证服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 17:27