Monday, October 03, 2011 7:30 AMI have developed the windows service & in windows service used the SQL server database .
when i will start the computer my windows service get started but it will not connect to the SQL server .it display the following message
"Cannot open user default database. Login failed.Login failed for user 'NT AUTHORITY\SYSTEM'."
I want to start my service when my computer starting.
how to establish the connection to SQL server database from windows service when starting the computer ?
Wednesday, October 05, 2011 3:06 AMModerator
Hi vrushali katkade,
According to the error message, you please try to follow the steps below to narrow down this issue:
First, make sure that the login 'NT AUTHORITY\SYSTEM' is existing under Security/Logins Node in the target instance on the management studio. If you cannot find it, please add the login by the following syntax:
sp_grantlogin ' NT AUTHORITY\SYSTEM '
Second, make sure the default database for ' NT AUTHORITY\SYSTEM ' login is available. For more information: Error message when you connect to an instance of SQL Server: "Cannot open user default database".
Third, go to 'Security->Logins' in Management Studio, open the properties window of ' NT AUTHORITY\SYSTEM ' login, at the 'User Mapping' tab, map the appropriate database and select the required database role for each database.
If the problem cannot be removed, you may need to check other configurations such as connection string, IIS, etc. Please have a look at the following threads with the similar issue:
Hope this helps.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.