views:

85

answers:

0

Hi,

I created a WCF client service (a Windows service) in C# which starts a BackgroundWorker in the OnStart to do the core functionality in the background and leaving the main thread managing the service itself. Maybe this approach is overkill but it's working without problems on my dev machine.

If I try to run it on the client machines the service starts but the BGWorker.DoWork event is not fired. (I write the EvenLog from the first row of the method). After calling RunWorkerAsync method the bgworker reports that it IsBuisy so it's doing s.g., but the EventLog has no clue about touching the DoWork event handler ever.

Could you suggest s.g. to catch this error? What could cause such a strange thing???

Environment: Dev: Win7 Ultimate, VS2008, C#, .Net 3.5 Clients: Win7 Prof and Vista with the latest updates.

Code:

protected override void OnStart(string[] args) { bgwServiceThread.DoWork += new DoWorkEventHandler(bgwServiceThread_DoWork); bgwServiceThread.RunWorkerAsync(); EventLog.WriteEntry(EventSource, "bgwServiceThread started: " + (bgwServiceThread.IsBusy ? "running" : "not running"), EventLogEntryType.Information); // Here it reports true, so the thread is running... ??? ... }

private void bgwServiceThread_DoWork(object sender, DoWorkEventArgs e) { EventLog.WriteEntry(EventSource, "bgwServiceThread_DoWork...", EventLogEntryType.Information); ... }

Many Thanks .

-- Csaba