I am trying to install a windows service I created in Visual Studio 2012 on Windows XP. How can I do this?
I tried following this tutorial, but had little luck implementing it. http://www.ehow.com/how_6046576_install-service-windows-xp.html
Is there anything wrong with my code?
Public Class MyFirstService
Dim WithEvents timer1 As New System.Timers.Timer
Protected Overrides Sub OnStart(ByVal args() As String)
timer1.Interval = 10000
timer1.Start()
WriteLog(Me.ServiceName & " has started ...")
End Sub
Protected Overrides Sub OnStop()
WriteLog(Me.ServiceName & " has stopped ...")
End Sub
Private Sub timer1_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles timer1.Elapsed
WriteLog(Me.ServiceName & " is running ...")
End Sub
Private Sub WriteLog(ByVal strMessage As String)
Dim strPath As String, file As System.IO.StreamWriter
strPath = AppDomain.CurrentDomain.BaseDirectory & "\MyService.log"
file = New System.IO.StreamWriter(strPath, True)
file.WriteLine("Test")
file.Close()
End Sub
End Class
When I click on my .exe I get this error message MyFirstService.exe is not a valid Win32 application. This is my first attempt at a window service app.