Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,

I'm working on web application projects, its almost completed, I have uploaded the application and database in the web hosting company.

I'm getting the error like

"System.Data.SqlClient.SqlException: Cannot open database "databasename" requested by the login. The login failed.
Login failed for user 'WINDOWS8-INDIA\IWAM_plesk(default)'"

XML
<appsettings>
   <add key="ConnectionString" value="server=localhost;database=databasename;uid=username;pwd=pwd;integrated security=true;" />
  </appsettings>


In thought in web.config will have error.

In local system it was working fine but in the server I'm getting the above error.

Can anyone give the solution.

Thanks in advance.
Posted
Updated 4-Feb-11 3:53am
v2

You've got the database connection set to use Windows Authentication, but the IIS server account is not a domain account...and it really shouldn't be.

Using SQL Server authentication is probably the easiest fix for this, but it's possible to use Windows authentication and pass the user's credentials through the IIS server to the database...if you don't mind reconfiguring the servers. If you Google "IIS double hop" you'll see why I say the other way is easiest.
 
Share this answer
 
In addition to GenJerDan's comments, I notice that you have Integrated Security set on yet you still have userID and password in there.
 
Share this answer
 
Comments
GenJerDan 4-Feb-11 10:47am    
Huh. I didn't even look at the connection string...just the error. Silly me. Changing that to "Persist Security Info=True" would probably fix it, assuming the login & password were valid on the SQL server.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900