Click here to Skip to main content
15,888,802 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
In my website I am accessing my SQL-server database using "windows authentication mode". Everything works fine when I run my website using visual studio 2012. but when I hosted my website on Plesk hosting provider, every time an error message comes that "Cannot open database "mydb" requested by the login. The login failed. Login failed for user 'WIN-JM04KI254SDM8\IWPD_1764(iamuser)'"

Please, friends, help me. I am facing this problem from last two days.

What I have tried:

<connectionStrings>
    <add name="conn" connectionString="Data Source=.\sqlexpress;Initial Catalog=mydb;Integrated Security=True;Pooling=False" providerName="System.Data.SqlClient"/>
  </connectionStrings>
Posted
Updated 5-Sep-17 4:12am

1 solution

Stop using windows authentication mode in production - it's not often supported. Instead, use a SQL username and password combination that has permission (and only the right permissions) for the tasks it needs to perform on the database. You can normally set up the users via the management console provided by your hosting service.
 
Share this answer
 
Comments
navi G 5-Sep-17 10:23am    
Thank you very much for suggestions dear, but can I change authentication mode windows to SQL username and password? If answer "yes" then what type of changes need to do in the connection string in web.config.
OriginalGriff 5-Sep-17 10:38am    
Oh, come on!
You know how to do that...

Data Source=SQLInstanceName;Initial Catalog=DatabaseName;User ID=TheUserName;Password=TheUserPassword
navi G 5-Sep-17 10:43am    
Cool Thanks very much You helped me every time.
OriginalGriff 5-Sep-17 10:51am    
You're welcome!

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