T
teejayem
I am having problems creating a Windows Service using Visual Studio
2005.
Code as follows:-
Imports System.IO
Imports System.Net.Mail
Public Class Service1
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set
things
' in motion so your service can do its work.
Timer1.Start()
End Sub
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop
your service.
Timer1.Stop()
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
email()
Dim test as new streamwriter("C:\test")
End Sub
Sub email()
Dim myMessage As New MailMessage("(e-mail address removed)",
"(e-mail address removed)", _
"test", "test")
Dim mysmtpclient As New SmtpClient("exchange03")
mysmtpclient.Send(myMessage)
End Sub
End Class
I have installed the service using the installutil
started the service using services manager in administritive tools
but
nothing happens.
i have tried doing various tasks within the timer tick procedure but
the service will not do anything. Am i missing something?? I know
my
code works as i have tested the code in a normal windows app. and
yes
i am uninstalling the service, rebuilding the project then
reinstlling
the service.
This is frustrating!!!!
Any help is mich appreciated.
Cheers, Tom.
2005.
Code as follows:-
Imports System.IO
Imports System.Net.Mail
Public Class Service1
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set
things
' in motion so your service can do its work.
Timer1.Start()
End Sub
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop
your service.
Timer1.Stop()
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
email()
Dim test as new streamwriter("C:\test")
End Sub
Sub email()
Dim myMessage As New MailMessage("(e-mail address removed)",
"(e-mail address removed)", _
"test", "test")
Dim mysmtpclient As New SmtpClient("exchange03")
mysmtpclient.Send(myMessage)
End Sub
End Class
I have installed the service using the installutil
started the service using services manager in administritive tools
but
nothing happens.
i have tried doing various tasks within the timer tick procedure but
the service will not do anything. Am i missing something?? I know
my
code works as i have tested the code in a normal windows app. and
yes
i am uninstalling the service, rebuilding the project then
reinstlling
the service.
This is frustrating!!!!
Any help is mich appreciated.
Cheers, Tom.