Another way to resolve connection problems is to enable SQL Server Authentication in IIS and then use the user ID and password in the connection string; or when asp.net should
Use the ASP.net impersonation method when using a program to run with another Windows user other than the ASPNET.
In order for the ASPNET account to have access to the database of the ASP.net application, you need to complete the following steps:
1 Start SQL Server Management Studio, specify the SQL Server instance name, and log on in Windows Authentication mode.
2 Use the Grantlogin stored procedure to add Windows users to the SQL Server database. This command will give the ASPNET account even
Permission to connect to SQL Server. Note that you want to replace the MachineName in the command with the host name of this computer.
Exec sp_grantlogin ' MACHINENAME\ASPNET '
3 after giving the ASPNET account the right to link SQL Server, you also need to give it access to the database of the ASP.net application.
Permissions. Note to replace Datebasename with the name of the ASP.net application's database:
Use Datebasename
Exec sp_grantdbaccess ' MACHINENAME\ASPNET '
4 Finally, you need to give the ASPNET access to the database internal objects of the ASP.net application, such as executing stored procedures, reading and
Modify tables, and so on. The easiest way to do this is to assign a db_owner role to the ASP.net application's database for the ASPNET account. If the previous steps
is already connected to the database of the ASP.net application, enter the following command:
Exec sp_addrolemember ' db_owner ', ' achinename\aspnet '
You can now connect to the database in Windows Authentication mode from the Web application.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.