Any good links on how to thing when designing windows services

  • Thread starter Thread starter christery
  • Start date Start date
C

christery

Jippie, got my first c# service working with XP/W2003srv (love
google), but got an hunch that vista will not support services that
uses GUI (can interact with desktop... checkbox in services gone?),

yepp (solution) can have 2 programs - one service and one normal GUI,
just wondering if anything else changes in the near future? sort of a
sneak peak into what trouble im haeding in to... gotta convert some
vb6 code soon that is like that will likely to be c# or vb.net for the
converted app... nice if I did it right the first time (for the first
time ;) )

we are not running vista, not eaven in the test env. we are sort of
staying of the (b)leeading edge, always wait until SP2 before u
upgrade to a new MS OS looks like a good iéa, so far anyway.

just wanna tap in to the thinktank ;)

Well, got rid of the last 2 OS/2 machines a year ago so im moving in
the right direction (?), but on the other hand didnt have any worries
about antivirus upgrades for those babys thease last years...

English isn´t my strong side, hope you can get heads or tails of what
I'm after...

//CY
 
having a service that interacts with the desktop is generally a very bad idea
anyway. The whole concept of a windows service is that it start with the OS -
before any real user has logged on. So if your service wants to do UI but
there is no desktop, what do you think will happen?

--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com
 
having a service that interacts with the desktop is generally a very bad idea
anyway. The whole concept of a windows service is that it start with the OS -
before any real user has logged on. So if your service wants to do UI but
there is no desktop, what do you think will happen?

--Peter
"Inside every large program, there is a small program trying to get out."http://www.eggheadcafe.comhttp://petesbloggerama.blogspot.comhttp://www.blogmetafinder.com

Shure, on my openVMS all logging goes to textfiles but this was a
"normal" VB6 program from the start that I made to a service to get
rid of the fact that I had to be logged in.

Well, it (UI) works in my VB6 service (when i found ntsvc.ocx or
whatever it was called some years ago), UI just showing what happens
(have to check box "can interact with desktop")- connect DB, read
file, update DB and so on, and more important what not when an error
occures, but (obviusly) only when support personel loggs in (no
special handling in code for that).

and yes i write log files with the same info, it makes life easyer if
the server stops for any reason to rule out my program, but that hasnt
happend /yet/ - havent used eventlogger in my VB6 service, in the C#
service I write to the eventlogg instead - no (G)UI there.

Looking for guidelines about programming services (ready/prepared for
the future development of windows), yes my app is threaded, no
racecondition what I can see, should be threadsafe *but* can one ever
be safe from bugs, dont think so....

had a worry about not using thread.sleep(5) in my while(true) loop, it
gets a bit slower but the service shoul never be able to drain all cpu
from the server, connecting to a RFID reader and that *should* take
250-700ms depending on read method, but if it goes wrong then I do
error logging and sleep 5 sek, the 5 ms delay is for an event where I
dont see that it goes wrong and it dosn´t take 250-700ms, then the
program would be like (worst case)

no real code, just how the program could behave

while(true) // should never stop reading
{
if (false) // an error occured that I didn´t expect, the false is the
return value from the reading of RFID, someone stole its static IP
address for ex.
{
}
}

so I put in a sleep in the main while loop just to be safe..

//CY
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top