Mssql database connection string for iis7.5 server

Posted by Mona.Agr1186 under ASP.NET on 4/20/2013 | Points: 10 | Views : 1394 | Status : [Member] | Replies : 2
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: Cannot open database "Vendor Register" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

Source Error:

Line 208: SqlDataAdapter dAdapter = new SqlDataAdapter();
Line 209: dAdapter.SelectCommand = cmd;
Line 210: con.Open();
Line 211: dAdapter.Fill(objDs);
Line 212:


Posted by: Raj.Trivedi on: 4/20/2013 [Member] [MVP] Starter | Points: 25

Hello Mona.

Check this

"Sharing is Caring"
Please mark as answer if your Query is resolved

Mona.Agr1186, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 4/20/2013 [Member] [MVP] [Administrator] NotApplicable | Points: 25

By looking at this , my first guess is that you used windows authentication in your connection string and in the server that you have hosted your Application , the user that runs IIS is 'NT AUTHORITY\NETWORK SERVICE'. so you need to give your application a user, or create a user that will perform only the certain things.

The Solution Provided in that link is not a good Solution.

Thank you for posting at Dotnetfunda

Mona.Agr1186, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response