Click here to Skip to main content
15,905,011 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionPOP3 and SSL Pin
ricky9227-May-08 6:42
ricky9227-May-08 6:42 
AnswerRe: POP3 and SSL Pin
Vasudevan Deepak Kumar27-May-08 19:18
Vasudevan Deepak Kumar27-May-08 19:18 
GeneralRe: POP3 and SSL Pin
ricky9228-May-08 2:17
ricky9228-May-08 2:17 
Questioneasy question...... I am having dumb moment. Pin
Cory Kimble27-May-08 4:59
Cory Kimble27-May-08 4:59 
AnswerRe: easy question...... I am having dumb moment. Pin
Chinners27-May-08 6:12
Chinners27-May-08 6:12 
AnswerRe: easy question...... I am having dumb moment. Pin
Rob Smiley27-May-08 6:16
Rob Smiley27-May-08 6:16 
GeneralRe: easy question...... I am having dumb moment. Pin
Vasudevan Deepak Kumar27-May-08 19:19
Vasudevan Deepak Kumar27-May-08 19:19 
AnswerRe: easy question...... I am having dumb moment. Pin
Mitch F.27-May-08 7:38
Mitch F.27-May-08 7:38 
AnswerRe: easy question...... I am having dumb moment. Pin
jzonthemtn27-May-08 9:08
jzonthemtn27-May-08 9:08 
GeneralRe: easy question...... I am having dumb moment. Pin
Christian Graus27-May-08 17:18
protectorChristian Graus27-May-08 17:18 
GeneralRe: easy question...... I am having dumb moment. Pin
jzonthemtn28-May-08 1:54
jzonthemtn28-May-08 1:54 
GeneralRe: easy question...... I am having dumb moment. Pin
Thomas Stockwell30-May-08 10:59
professionalThomas Stockwell30-May-08 10:59 
QuestionFile access sharing Pin
manisghouri27-May-08 4:36
manisghouri27-May-08 4:36 
AnswerRe: File access sharing Pin
Rob Smiley27-May-08 6:22
Rob Smiley27-May-08 6:22 
Questionhow to solve client machine crystal report error?? Pin
ranipriya 201027-May-08 3:05
ranipriya 201027-May-08 3:05 
RantRe: how to solve client machine crystal report error?? Pin
jzonthemtn27-May-08 9:05
jzonthemtn27-May-08 9:05 
AnswerCP Ignore: Repeat Offender Pin
leckey27-May-08 14:35
leckey27-May-08 14:35 
QuestionWindows Service - The service "started and then stopped" ?! Pin
007jb27-May-08 3:03
007jb27-May-08 3:03 
AnswerRe: Windows Service - The service "started and then stopped" ?! Pin
Christian Graus27-May-08 3:16
protectorChristian Graus27-May-08 3:16 
GeneralRe: Windows Service - The service "started and then stopped" ?! Pin
007jb27-May-08 3:46
007jb27-May-08 3:46 
GeneralRe: Windows Service - The service "started and then stopped" ?! Pin
Rob Smiley27-May-08 6:27
Rob Smiley27-May-08 6:27 
AnswerRe: Windows Service - The service "started and then stopped" ?! Pin
Peter Josefsson Sweden27-May-08 15:30
Peter Josefsson Sweden27-May-08 15:30 
Hi!

Some thoughts/experiences with services:

1. You can't use message boxes (or any other form of user interaction) from services (unless you check the "allow service to interact with desktop" in the service manager, but that is very bad practice). Use the event log instead (see the example in the documentation for System.ServiceProcess.ServiceBase class in the framework class library). This is probably what causes your service to crash. Make sure neither your service nor the libraries you use rely on user interaction.

2. The System.Threading.Timer class is the right one to use in a service (the Windows Forms timers don't work - they rely on the window message pump, which doesn't exist in a service), but beware that it doesn't work like the Windows Forms timer: Among other things, it continues to fire events even when one is executing, so you have to do some synchronization (or disable and then reenable the timer) in Timer_Tick.

3. An exception on your worker thread (Timer_Tick) vanishes without a trace and the service doesn't stop because of it. Make Timer_Tick very small, containing only a try/catch block that logs any exceptions (and possibly does an Environment.FailFast if things look hopeless) and calls another member that does the actual work.

Hope this helped.

Peter the small turnip

(1) It Has To Work. --RFC 1925[^]

QuestionStart Up Code Pin
Jared774427-May-08 2:35
Jared774427-May-08 2:35 
AnswerRe: Start Up Code Pin
Christian Graus27-May-08 3:13
protectorChristian Graus27-May-08 3:13 
QuestionAppend or Insert the Text in Outlook 2003 message body using vb.net Pin
~Khatri Mitesh~27-May-08 0:28
~Khatri Mitesh~27-May-08 0:28 

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.