Wednesday, March 21, 2012

Login failed for user

Application works fine when run on local computer, but when accessed from another computer or after moving to hosted server, I get the 'Login failed for user SERVERNAME\iusr_servername' error. The application is attempting to access SQL Server 2000 database with hard coded user name and password. I've read about how to do this and it works fine locally, but I don't see what I am missing. Help!See the steps I listed inthis post to solve your problem.
|||Thanks for your response. This helps a bit, but not completly. After adding the IUSR account and granting access to the database, I was able to connect properly from my test computer to my developement computer that is running the app and the SQL Server after removing all authenticated access in IIS. Unfortunately, I don't have that degree of access on the hosted SQL Server. I thought that the connection string was used to gain access to the SQL Server, and don't understand why the IUSR account needs to have access as well.|||

It is because I bet you in your connection string, you are using trusted connections. On the production box, what you will have to do is either ask your hoster to grant access to that database. The best secure way is to create a whole new windows user account for you and set the IIS application to run under your user. That user is also given grant access to that database.

However, the likelihood of that happening sounds low. Why don't you specify a SQL user name and password (without the trusted connection)?

|||Thank you! I knew that the answer had to be something simple that I was missing. Nothing like being a rooky. Removing the Trusted Connection did the trick.

No comments:

Post a Comment