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 \ local.demo.cn'.
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 \ local.demo.cn '.
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
Select:
Default Schema: DBO
Schema owned by this user: db_owner
Database role membership: db_owner
4. Restart the application pool.