Sql Connection fails when using Integrated Security on IIS applications

纵然是瞬间 提交于 2019-12-06 16:00:11

问题


In my web application on IIS 7.0, I want to make a connection to Sql Database Server for which my user is granted for Windows Authentication. (Integrated Security=SSPI)

Login fails for user 'DOMAIN\COMPUTER_NAME$', however I still can connect to database over connect window of Sql Server Management Studio (with DOMAIN\USER_NAME).

How can I connect to Sql Server over my web application?


回答1:


I've found the solution.

On IIS, open Application Pool settings.

For Identity option, choose "Custom Account".

Enter your username (DOMAIN\USERNAME) and password.

It's done.




回答2:


My problem was that I had to assign the application pool accounts in SQL Server the db_owner role. I felt that was too much permission but it is the only thing that worked. my book said to give it db_datareader and db_datawriter roles but that did not work.

I'm using SQL Server with Windows Authentication, Windows 7 Home Premium with IIS all on the same machine.

Perhaps someone else will search this issue and find my answer useful.




回答3:


Being able to connect to a database is a privilege in itself

You may still need to do something like this to give the IIS service account access

USE [<database name>]

GRANT CONNECT TO '<DOMAIN\COMPUTER_NAME$>'


来源:https://stackoverflow.com/questions/13512328/sql-connection-fails-when-using-integrated-security-on-iis-applications

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