用户'用户名'登录失败。 [英] Login failed for the user 'username'.

查看:117
本文介绍了用户'用户名'登录失败。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我为我的应用程序创建了一个Windows身份验证,我在应用程序池身份中使用了我的凭据,但我没有在数据库中添加我的登录凭据因此我收到以下异常



用户''用户名''登录失败。



我想知道是否可以在不添加数据库中的登录凭据的情况下执行Windows身份验证

Hi

I have created a windows authentication for my application and I have used my credentials in the applicationpool identity and I have not added my login credentials in the database and hence I am getting the following exception

Login failed for the user ''username''.

I want to know whether it is possible to perform windows authentication without adding the login credentials in the database

推荐答案

这取决于您登录的内容。



您需要使用Windows身份验证连接到SQL服务器,这样您的kerberos令牌就会从站点传递,而不是用户名/密码。它可以在Web应用程序的web.config中轻松实现:



It depends what you are logging in to.

You need to connect to the SQL server using windows authentication, that way your kerberos tokens are passed from the site, not the username/password. It is achieved easily in the web application''s web.config:

<connectionStrings>
  <add name="DBConnName" connectionString="Initial Catalog=Foo;Data Source=Bar;Integrated Security=SSPI;"/>
</connectionStrings>





大胆部分告诉用于传递Windows凭证令牌的IIS。



然后您需要授予运行IIS进程访问权限的Windows帐户,详情其他 [ ^ ]。





使用自己的帐户是个坏主意,如果您更改密码,您的网站将停止工作。您需要特别设置一个帐户,请注意,在任何一种情况下,IIS服务器和SQL服务器都需要访问该帐户,因此它必须在域中信任。



MS在整个过程中提出了一个有用的干燥建议,这里 [ ^ ]。


这篇关于用户'用户名'登录失败。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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