Posts Tagged ‘debugging’
How to Debug Window Service without installing
Posted by: admin in .NET, Window Services on September 3rd, 2010
Usually if we want to debug the windows service project to see if it is behaving as we expected, what we do is by installing the windows service and attaching that project to the process.
There is also another way to debug without installing it, what we need to do is by creating another project such as console project then copy and paste the code below.
-
Sub Main()
-
#If Not Debug Then
-
Dim servicesToRun As System.ServiceProcess.ServiceBase()
-
-
servicesToRun = New System.ServiceProcess.ServiceBase() {New MyService()}
-
System.ServiceProcess.ServiceBase.Run(servicesToRun)
-
#Else
-
Dim service As AS2Client.AS2SenderService = New MyService()
-
service.myentrysub()
-
-
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite)
-
-
#End If
-
-
-
-
End Sub
References:
Run Windows Service as a Console program