java
php
iphone
css
python
mysql
database
objective-c
visual-studio
multithreading
eclipse
silverlight
flash
algorithm
facebook
cocoa
tsql
apache
asp
postgresql
Where is that first code located?
Without that context, my best guess is that your OnStart() method fires, and then the service quits as soon the method ends because there's nothing left to do.
Also, I'm not a fan of the while (true) { Sleep(60000); // do work } pattern for services. Instead, you want to look for a function that actually blocks execution to keep your code going. Examples include TcpListener.AcceptTcpClient() and Thread.Join(). If you can't find something like that for the meat of your service, you may want to do something like set up a scheduled task instead.
while (true) { Sleep(60000); // do work }
TcpListener.AcceptTcpClient()
Thread.Join()
You've placed the code outside of a function. What you have shown in the question should not even compile, and it certainly won't loop.
Note the //TODO: comment in the OnStart function definition:
//TODO:
OnStart
protected override void OnStart(string[] args) { base.OnStart(args); //TODO: place your start code here }