change web application authentication to use Windows Authentication

半腔热情 提交于 2019-12-13 04:19:58

问题


I'm trying to publish my web application on IIS 8.5, but I'm getting this error when the application tries to retrieve data from the SQL Server 2008.

InnerException: {Message:An error has occurred., ExceptionMessage:Login failed for user 'domainname\WES-JXC2J02$'.,…} ExceptionMessage: "Login failed for user 'domainname\WES-JXC2J02$'."

The SQL Server doesn't have WES-JXC2J02$ listed as the authorized user because it's my dev machine name. If I try to add the machine name as user in SQL Server it gives me an error because there's no such user in the domain. I want to use Windows Authentication which is set to enable in IIS. What can I do to fix it?


回答1:


So, apparently, as @MikeCheel said, it was forwarding my machine credentials to the SQL Server to retrieve the data from the database. Turned out, I needed to create a new login in SQL Server with limited access, then add the user id and password in the connectionString. I learnt it the hard way that SQL Server must have SQL and Windows Authentication enabled. Once that was configured, connection was setup and the data displayed properly.



来源:https://stackoverflow.com/questions/24941527/change-web-application-authentication-to-use-windows-authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!