(转)windows身份验证登入数据库 iis 无法访问数据库

原文地址:http://www.cnblogs.com/d-xtl/archive/2011/12/27/2303890.html

System.Data.SqlClient.SqlException: 用户'pc-2009\ASPNET' 登录失败的解决办法 
今天发布网站的时候遇到这个问题,多方查询后终于找到答案!

System.Data.SqlClient.SqlException: 用户'pc-2009\ASPNET' 登录失败的解决办法: (此处的PC-2009是我的机器名)

由于他的数据库连接语句中没有采用用户名和密码验证,采用的是windows集成验证,所以无法连接数据库。

解决方法很简单,加上ASPNET这个账号,赋予权限即可,具体方法如下:

1、企业管理器--》安全性--》登陆--》(右键)新建登陆--》名称(在列表中添加ASPNET这个用户);

2、然后在服务器角色一栏中选择System Administrators;

3、在数据库访问一栏中选择所要访问的数据库,然后在下面对话框中将db_owner选上,确定即可!

----------------------------------------------------------------------------------------------------------------------------------------

风筝:

在IIS中发布WebSite,然后连接SQLServer2005,采用windows身份验证数据库,结果访问数据库时报错,如下:

Server Error in '/PaidTimeOffUI' Application.


Cannot open database "HRPaidTimeOff" requested by the login. The login failed.
Login failed for user (ComputerName)\ASPNET'.

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 "HRPaidTimeOff" requested by the login. The login failed.
Login failed for user 'ComputerName\ASPNET'.

-------------------------------------------------------------------

上网搜,有如下解释:

1、http://p2p.wrox.com/book-asp-net-3-5-enterprise-application-development-visual-studio-2008-problem-design-solutio/80312-problem.html

2、...What I did to resolve this was, disable anonymous access, then enable digest authentication so IIS will look at the domain. In the realm area select or type your fully qualified domain and this should work....

http://p2p.wrox.com/book-asp-net-3-5-enterprise-application-development-visual-studio-2008-problem-design-solutio/73386-problem-compile.html

其中涉及到IIS配置,不懂~~于是按照上面方法在SQLServer中添加了ASPNET用户,得以解决,以后一定要学些IIS配置!

2012.02.21 晚

转载于:https://www.cnblogs.com/fiteg/archive/2012/02/21/2361783.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值