Cannot open database “XXX” requested by the login. The login failed.
2011-12-19 13:42 Wizardlsw 阅读(3768) 评论(0) 编辑 收藏 举报原来在数据库上的操作都很正常,可后来改了些代码,无缘无故地出现这个问题:
Cannot open database \"SmileCat\" requested by the login. The login failed.\r\nLogin failed for user ‘XXXXXX\\slin'
Solution:
http://stackoverflow.com/questions/454497/iis7-sql-2008-and-asp-net-mvc-security
Reference:
http://learn.iis.net/page.aspx/624/application-pool-identities/
现在在IIS7.5中已经可以按上面的解决方案解决了,可现在在VS中还是不行,遇到这样的错误:
{"Unable to open the physical file \"D:\\Shaowei\\Projects\\Src\\SmileCat\\Presentation\\SmileCat.WebApi\\App_Data\\SmileCat.mdf\". Operating system error 2: \"2(The system cannot find the file specified.)\".\r\nCannot open database \"SmileCat\" requested by the login. The login failed.\r\nLogin failed for user 'CXXXX\\slin'.\r\nFile activation failure. The physical file name \"D:\\Shaowei\\Projects\\Src\\SmileCat\\Presentation\\SmileCat.WebApi\\App_Data\\SmileCat.ldf\" may be incorrect."}