Mssql database connection string for iis7.5 server

Posted by Mona.Agr1186 under ASP.NET on 4/20/2013 | Points: 10 | Views : 965 | 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:




Responses

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

Up
0
Down
Hello Mona.


Check this


http://stackoverflow.com/questions/2251839/login-failed-for-user-nt-authority-network-service

Regard's
Raj.Trivedi
"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

Up
0
Down
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
[Administrator]

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

Login to post response