MDeibert:I'm getting a "Cannot open database "NorthWind" requested by the login. The login failed." when I run my asp.net app. So I make some changes in the database, then I edit the connection info in the web.confg. Nothing happens no matter what I put in the connection info. I get the same error over, and over, and over, and over, and over. I can type any garbage at all in that connection string info and I get the same error. I don't understand what is going on. Does this make any sense to you? Thanks in advance for your help. I'm totally dead in the water.
Hi MDeibert,
From your description, we can know you encounter an issue that the web application cannot connect to the SQL Server with login-failed error. In addition, we are told that you tried everything in database and changed connection string in web.config, but no luck. However, from this information we cannot guess what you have done exactly. It would be best if you can tell us what you have done with posting detailed information, such as the connection string, SQL Server login user name, IIS version, and so on.
For you reference, I post the following steps for troubleshooting this kind issue. If I have any misunderstanding, please let me know.
1. Check the login user name from error message, for example: <Cannot open database "NorthWind" requested by the login. The login failed. Login failed for user 'MachineName\ASPNET'>.
2. Add the login user in SQL Server login list.
a. Open SQL Server Management Studio, and connect your SQL Server instance.
b. Expand the “Security” node.
c. Right click the “Logins” node, and then select “New Login…”.
d. Add the “ASPNET” (for IIS 5.x) account or “Network Service” (for IIS 6.0) and grant access permission to the NorthWind database.
3. If you use SQL Server authentication (specify user name and password in connection string), please make sure the authentication mode is the mixed mode.
a. Open SQL Server Management Studio, and connect your SQL Server instance.
b. Right click SQL Server instance node, and then select “Properties”.
c. Click the “Security” node.
d. Check the “SQL Server and Windows Authentication mode” option of “Server authentication”.
4. If the login user in the error message is null, based on my experience, the web server and SQL server are not the same machine, and the web application use non-fixed impersonation. For this issue, please use SQL Sever authentication or impersonate fixed identity instead. For more informaitn, please refer to the following link:
How To: Use Impersonation and Delegation in ASP.NET 2.0
http://msdn.microsoft.com/en-us/library/ms998351.aspx
5. Make sure the connection string is correct, you can find many SQL Server connection string samples from the following link:
http://www.connectionstrings.com/