System.Data.SqlClient.SqlException: failed to open the requested database login.

  • 2020-05-12 02:30:21
  • OfStack

The problem is this... I am in VS2008 directly run open web page, can connect to the database... But by entering the address, can also open the web page, but involving the database on the problem...
Unable to open the requested database "TakeClass" for login. Login failed.
Users' 2 D2727E2578F446 \ ASPNET 'login failed.
Note: during the execution of the current Web request, an unhandled exception occurred. Check the stack trace information for more information about this error and the source of the error in the code.

Exception details: System Data. SqlClient. SqlException: unable to open the login the requested database "TakeClass". Login failed.
Users' 2 D2727E2578F446 \ ASPNET 'login failed.

Before also encountered this problem, after searching by the following method to solve.

1. Open the database enterprise manager, and select database -- security -- to find out which "XXX\ASPNET" -- right click "properties ";
2. Select the "user mapping" option -- select the database we want to access
3. Don't click ok -- select which database we just selected. In the "database role membership" section below, select the "db_owner" permission

Related articles: