windows service
-
hi I wrote a windows service in c# that its starttype is aoutomatic but when I restart or start the computer it's not working. it is only working manual why its happen?? thanks
Is your service dependent on another service? Then make sure that the other service is started before.
-
I would suggest that you write to the event log after each call (timer1start(), processorid()...) This will show you when your service hangs...
It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.
no event log doesn't work after functions. but it is working manual succesfully
-
Is your service dependent on another service? Then make sure that the other service is started before.
a lot of services start before which is depend on how am I understand?
-
no event log doesn't work after functions. but it is working manual succesfully
Ok, and after which function? You should try to log to the disk (fixed file would be sufficient first) so that you can reconstruct the point of failure...
It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.
-
Ok, and after which function? You should try to log to the disk (fixed file would be sufficient first) so that you can reconstruct the point of failure...
It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.
"You should try to log to the disk" How am I doing it??
-
"You should try to log to the disk" How am I doing it??
You have several possibilities: 1. Use log4net: http://logging.apache.org/log4net/index.html[^] 2. Directly writing to a file: http://msdn.microsoft.com/en-us/library/aa287548%28VS.71%29.aspx[^]
It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.
-
You have several possibilities: 1. Use log4net: http://logging.apache.org/log4net/index.html[^] 2. Directly writing to a file: http://msdn.microsoft.com/en-us/library/aa287548%28VS.71%29.aspx[^]
It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.
sorry I didn't understand like this.I can it. I will test it too, thanks..
-
protected override void OnStart(string[] args) { inform("START");// for event log timer1.Start(); proccessorid();//I give all system info learnsystem(); Process.Start(string.Format("http://XXX.XXX.XX.X:4561/Default.aspx?proccessor\_Id={0}",proccessor.ToString()));//I send system info a web page }
A wild guess is that the Process.Start can't run at that time (for whatever reason). Maybe put it in a try, wait and loop a few times if it fails.
for maybe three times
try
Process.Start
break
catch
wait a minute or soBetter yet, run that on a separate thread so the OnStart completes in a timely manner.
-
A wild guess is that the Process.Start can't run at that time (for whatever reason). Maybe put it in a try, wait and loop a few times if it fails.
for maybe three times
try
Process.Start
break
catch
wait a minute or soBetter yet, run that on a separate thread so the OnStart completes in a timely manner.
hi all I put out the "Process.start" code, but it is not working. Only first inform("start") works, anothers not work Thats no problem on manual..
-
hi all I put out the "Process.start" code, but it is not working. Only first inform("start") works, anothers not work Thats no problem on manual..
What does the code look like now?
-
What does the code look like now?
protected override void OnStart(string[] args) { inform("START");// for event log timer1.Start(); proccessorid();//I give all system info learnsystem(); }
-
protected override void OnStart(string[] args) { inform("START");// for event log timer1.Start(); proccessorid();//I give all system info learnsystem(); }
I think when I try learning proccesorid and all system info , the code is failed. I put out them and service started normally in boot.. But I have to take those informations.
-
a lot of services start before which is depend on how am I understand?
-
Open services.msc. Right click on any service. You can see properties menu in pop menu. When you open properties of the service. you will see dependencies tab. Regards, Sunil G.
no dependencies
-
no dependencies
-
anyway start type is automatic
-
protected override void OnStart(string[] args) { inform("START");// for event log timer1.Start(); proccessorid();//I give all system info learnsystem(); }
Get the learnsystem out of the OnStart; it doesn't belong there. OnStart must start the process and exit; that's all.
-
Get the learnsystem out of the OnStart; it doesn't belong there. OnStart must start the process and exit; that's all.
where do I get it
-
where do I get it
Probably in the main part of the Service -- perhaps check to see whether or not the system is learned:
If not learned
Try to learn
If failed, log and return
Do stuffYou could then periodically check for changes in the system, too.