I\'ve got a windows service written in C#. I\'ve read all the google threads on how to debug it, but I still can\'t get it to work. I\'ve run \"PathTo.Net
I recently added this to a project and it works great for me. You can debug it just like any other EXE. After it is added go to your project properties and add a command line parameter (/EXE) in the Debug tab for the Debug build configuration.
_
Shared Sub Main()
''
'' let's add a command line parameter so we can run this as a regular exe or as a service
''
If Command().ToUpper() = "/EXE" Then
Dim app As MyService = New MyService()
app.OnStart(Nothing)
Application.Run()
Else
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
' More than one NT Service may run within the same process. To add
' another service to this process, change the following line to
' create a second service object. For example,
'
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
'
ServicesToRun = New System.ServiceProcess.ServiceBase() {New MyService}
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
End If
End Sub