Click here to Skip to main content
15,909,051 members
Home / Discussions / C#
   

C#

 
AnswerRe: Service Starting Problem! Pin
#realJSOP2-Jun-08 23:27
professional#realJSOP2-Jun-08 23:27 
Add a keep-alive thread that doesn't do anything but sleeps for 4.5 seconds.

protected void KeepAliveThread()
{
	ServiceController controller = new ServiceController(this.ServiceName);
	while (true)
	{
		if (controller.Status == ServiceControllerStatus.Running)
		{
			Thread.Sleep(4500);
		}
	}
}


In your OnStart() method, do this:

Thread thread = new Thread(new ThreadStart(KeepAliveThread));
thread.Start();



"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001


GeneralRe: Service Starting Problem! Pin
backSlashZero3-Jun-08 0:08
backSlashZero3-Jun-08 0:08 
GeneralRe: Service Starting Problem! Pin
#realJSOP3-Jun-08 0:33
professional#realJSOP3-Jun-08 0:33 
GeneralRe: Service Starting Problem! Pin
backSlashZero3-Jun-08 0:52
backSlashZero3-Jun-08 0:52 
Questionhelp in binding data to dropdowmlist Pin
csp2-Jun-08 22:44
csp2-Jun-08 22:44 
QuestionError stop Http Listener Pin
George_George2-Jun-08 21:58
George_George2-Jun-08 21:58 
AnswerRe: Error stop Http Listener Pin
N a v a n e e t h2-Jun-08 22:26
N a v a n e e t h2-Jun-08 22:26 
GeneralRe: Error stop Http Listener Pin
George_George2-Jun-08 22:45
George_George2-Jun-08 22:45 
GeneralRe: Error stop Http Listener Pin
N a v a n e e t h2-Jun-08 22:51
N a v a n e e t h2-Jun-08 22:51 
GeneralRe: Error stop Http Listener Pin
George_George2-Jun-08 23:01
George_George2-Jun-08 23:01 
GeneralRe: Error stop Http Listener Pin
N a v a n e e t h2-Jun-08 23:12
N a v a n e e t h2-Jun-08 23:12 
GeneralRe: Error stop Http Listener Pin
GDavy2-Jun-08 23:08
GDavy2-Jun-08 23:08 
GeneralRe: Error stop Http Listener Pin
N a v a n e e t h2-Jun-08 23:12
N a v a n e e t h2-Jun-08 23:12 
GeneralRe: Error stop Http Listener Pin
GDavy2-Jun-08 23:20
GDavy2-Jun-08 23:20 
GeneralRe: Error stop Http Listener Pin
George_George2-Jun-08 23:42
George_George2-Jun-08 23:42 
GeneralRe: Error stop Http Listener Pin
N a v a n e e t h2-Jun-08 23:56
N a v a n e e t h2-Jun-08 23:56 
GeneralRe: Error stop Http Listener Pin
George_George3-Jun-08 1:24
George_George3-Jun-08 1:24 
GeneralRe: Error stop Http Listener Pin
N a v a n e e t h3-Jun-08 1:40
N a v a n e e t h3-Jun-08 1:40 
GeneralRe: Error stop Http Listener Pin
George_George3-Jun-08 2:16
George_George3-Jun-08 2:16 
GeneralRe: Error stop Http Listener Pin
N a v a n e e t h3-Jun-08 2:30
N a v a n e e t h3-Jun-08 2:30 
GeneralRe: Error stop Http Listener Pin
George_George3-Jun-08 2:49
George_George3-Jun-08 2:49 
GeneralRe: Error stop Http Listener Pin
N a v a n e e t h3-Jun-08 7:03
N a v a n e e t h3-Jun-08 7:03 
GeneralRe: Error stop Http Listener Pin
George_George3-Jun-08 15:23
George_George3-Jun-08 15:23 
GeneralRe: Error stop Http Listener Pin
N a v a n e e t h3-Jun-08 15:33
N a v a n e e t h3-Jun-08 15:33 
GeneralRe: Error stop Http Listener Pin
George_George3-Jun-08 15:49
George_George3-Jun-08 15:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.