Solution iis7.5 site cannot log on to sqlexpress

Source: Internet
Author: User

Configure local sqlexpress in iis7:

Data Source=. \ Sqlexpress; initial catalog= Demo_db; Integrated Security=True;

The following error occurs:

Cannot open database "demo_db" requested by the login. The Login Failed.
Login Failed for user'IIS apppool \'.

Description: An unhandled exception occurred during the execution of the current Web request.
Please review the stack trace for more information about the error and where it originated in the code.

Exception details: system. Data. sqlclient. sqlexception: cannot open database"Demo_db"Requested by the login.
The login failed.
Login Failed for user 'iis apppool \ '.

Application in iis7.5ProgramThe pool is no longer'Nt authority \ Network Service", Make the following changes:

1. Modify the process model --> identity of the application pool of the site to the application

Changed from applicationpoolidentity to NetworkService

2. Use mssm to open. \ sqlexpress and add users:

. \ Sqlexpress --> Security --> logins --> NT Authority \ Network Service

Set User mapping:

Users mapped to this login: select the target database. The default schema is DBO.

Database role membership for: demo_db, select the role db_owner

3. Specify the database owner user

. \ Sqlexpress --> demo_db --> sceurity --> Users --> View attributes of nt authority \ Network Service


Default Schema: DBO

Schema owned by this user: db_owner

Database role membership: db_owner

4. Restart the application pool.

Contact Us

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: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.