October 3, 2011 at 1:09 am
I 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 ?
October 3, 2011 at 1:17 am
Are you able to log on to SQL Server using the sa account and verify that NT AUTHORITY\SYSTEM has an associated login and what is the default database for the account.
October 3, 2011 at 1:29 am
I have default login of the windows mode (local system account)
October 3, 2011 at 1:29 am
I have default login of the windows mode (local system account)
October 3, 2011 at 1:33 am
Right click this login in SQL Server Management Studio, select properties and at the bottom of the dialog and tell me what the default database is.
October 3, 2011 at 1:36 am
default database is master
October 3, 2011 at 1:41 am
Hmm, okay, need to get the context nailed down:
Is the SQL Server using mixed mode, or Windows authentication?
Is the SQL Service running?
What are you attempting to do when you get the error?
Where are you finding the error?
October 3, 2011 at 2:42 am
Is the SQL Server using mixed mode, or Windows authentication?
Windows authentication
Is the SQL Service running?
yes
What are you attempting to do when you get the error?
i have used the SQL server database connection into the windows service (created windows service in C#.NET). All windows service started after computer started or restarted. After starting or restarting the computer my windows service started & at the time of reading the data from the database ,it displays the message as
"Cannot open user default database. Login failed.Login failed for user 'NT AUTHORITY\SYSTEM'".
Where are you finding the error?
when I have read the data from the database it will thrown an exception in message box
October 3, 2011 at 1:54 pm
This could be a problem with the connection string - check it carefully for typos 🙂
October 4, 2011 at 12:11 am
my connection string
Data Source = .\\SQLEXPRESS; AttachDbFileName= path\\datbasename.mdf;Connect Timeout=1000;Trusted_Connection=True
October 4, 2011 at 12:14 am
The connection string is the string used to connect to SQL server. It will be in the C# project and should contain servername, username, security info etc...
It would be also be interesting ot have a look at the login errors being written into the SQL Server error logs.
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply