解决IIS7.5站点不能登录SQLEXPRESS

在IIS7站点中配置使用本地sqlexpress:

Data Source=.\SQLEXPRESS;Initial Catalog=demo_db;Integrated Security=True;

会遇到如下错误:

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'.

在IIS7.5中应用程序池已经不是 'NT AUTHORITY\NETWORK SERVICE“,做如下修改:

1、修改站点对应用的应用程序池的Process Model --> Identity

由ApplicationPoolIdentity修改为NetworkService

2、用MSSM打开.\SQLEXPRESS,添加用户:

.\sqlexpress --> Security --> Logins --> NT AUTHORITY\NETWORK SERVICE

设置其User Mapping:

Users mapped to this login:选择目标数据库,Default Schema为dbo

Database role membership for : demo_db,选择角色db_owner

3、指定数据库owner用户

.\sqlexpress --> demo_db --> Sceurity --> Users --> 查看NT AUTHORITY\NETWORK SERVICE属性

选择:

Default schema: dbo

Schema owned by this user: db_owner

Database role membership: db_owner

4、重启应用程序池后生效。

转载于:https://www.cnblogs.com/chenjunbiao/archive/2011/08/24/2151719.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值