469,908 Members | 2,219 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,908 developers. It's quick & easy.

Windows service problem

I am working on a Windows Service application in VB.net 2008. The main objective of the application is to monitor starting and stopping of applications listed in a file. I build the service as system level by using ‘System’ user account. I used “Management.ManagementEventWatcher” class to get event handlers for starting and stopping of processes. I used following code to set process arrived event

mManagementStartWatcher = New ManagementEventWatcher("Select * From Win32_ProcessStartTrace")
AddHandler mManagementStartWatcher.EventArrived, AddressOf ManagementWatcher_StartEventArrived
This works fine as whenever a process is launched in the computer it raises the event routine “ManagementWatcher_StartEventArrived”. Now the problem I am facing is, whenever I starts/stops my service multiple times it stops raising “ManagementWatcher_StartEventArrived” event. It remain as it is even if I restart my service and also start it after unistalling and installing (using sc.exe and installutil). This starts working only when I restarts my computer.

My service executeable handles ‘-i/-u’ arguments to self install/uninstall. I used following code to install/uninstall

Dim ArgString As String()

' Set arguments to install/uninstall service

If InstallSrv Then
ArgString = New String() {"/LogFile=", SrvExePath}
ArgString = New String() {"/u", "/LogFile=", SrvExePath}
End If

' Install/uninstall service

Call ManagedInstallerClass.InstallHelper(ArgString)

Please guide me in this regard.

Thanks and Regards,

Sep 8 '10 #1
0 841

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by John Rebocho | last post: by
reply views Thread by W Akthar | last post: by
reply views Thread by Miguel Hernandez | last post: by
3 posts views Thread by alegon | last post: by
1 post views Thread by Remy De Almeida | last post: by
8 posts views Thread by DF Dev | last post: by
6 posts views Thread by =?Utf-8?B?QW5kcmV3?= | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.