Showing posts with label moving. Show all posts
Showing posts with label moving. Show all posts

Wednesday, March 28, 2012

login failed for user after moving app to web server

My app works fine in development server. After moving to web server, error occured as bellow. Can someone help me? I use vs 2005 and SQL server is windows authentication mode.

Login failed for user 'domain_name\REPORT$'.

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: Login failed for user 'domain_name\REPORT$'.

Source Error:

Line 348:Line 349: If MyTable = Nothing ThenLine 350: MySQLDataAdapter.Fill(MyDataSet)Line 351: ElseLine 352: MySQLDataAdapter.Fill(MyDataSet, MyTable)

Hi,

Are you running your application (web server) on a windows 2003 server ? If yes then you have to add a login withdomain_name\<machine_name>$ and you have to grant access to the operative database to this login. This login weill be a windows account (domain not machine).

Hope it Helps!

Bhaskar!

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.