Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Problem with Windows Service / Permissions?

Author  Topic 

pkellner
Starting Member

1 Post

Posted - 2010-08-01 : 10:56:43
I've create a simple windows service with win7, vs2010 and default permissions (open as admin).

I use a very vanilla connect string

"Server=w500;Database=SyncToyClone;Integrated Security=SSPI;" {and I've also tried with sa/password}

and SqlConnection.Open(..) works, but when I try to read a row from a table with simple ado.net, I get back no rows. When I call the same code from a simple windows console app it works fine.

Anyone know what is different about running in a service?

Thanks

Peter Kellner
http://peterkellner.net
Microsoft MVP ASP.NET

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2010-08-02 : 08:46:58
Here's some checks that may help towards an answer:
Do you get an error when no rows are returned? Check your error handling procedure too.
If any, please post the error message.

If not:
Do you have a WHERE clause in the SELECT statement that could be filtering out the rows?
Is it a table or a view you are querying - maybe there is a filter in the view?
Can you view the code in SQL Profiler to see exactly what statement is being passed to the database?
Is the service account and the account executing via the simple windows console app the same?
If it's different accounts: Are you using schemas?
Go to Top of Page
   

- Advertisement -