471,854 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,854 software developers and data experts.

Help creating Windows Service .net studio 2005

I am having problems creating a Windows Service using Visual Studio

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
' in motion so your service can do its work.
End Sub
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop
your service.
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Dim test as new streamwriter("C:\test")
End Sub
Sub email()
Dim myMessage As New MailMessage("t...@test.com",
"tom.mil...@gmail.co.uk", _
"test", "test")
Dim mysmtpclient As New SmtpClient("exchange03")
End Sub
End Class
I have installed the service using the installutil
started the service using services manager in administritive tools
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
code works as i have tested the code in a normal windows app. and
i am uninstalling the service, rebuilding the project then
the service.
This is frustrating!!!!
Any help is mich appreciated.
Cheers, Tom.

Sep 4 '07 #1
2 1683

<te******@gmail.comwrote in message
news:11**********************@r29g2000hsg.googlegr oups.com...

This is frustrating!!!!
Any help is mich appreciated.

I would suspect that the Service application has terminated along the way,
and you don't know it. I'll assume you are using try/catch/blocks on code in
critical areas like on the OnStart and Onstop and any other areas needed,
along with an Event log to capture error messages.

If you are using a NT based O/S like XP, then you can enable the Messenger
Service and use the Netsend command in the code to send messages to the
machine the Service is running on. The Netsend command will pop a message
box on the screen that you will have to reply to, but it can be used to send
messages to yourself as to just where you are at in the Service code that
can help you in your debugging process.

Sep 4 '07 #2
On 4 Sep, 18:33, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:
<teeja...@gmail.comwrote in message

news:11**********************@r29g2000hsg.googlegr oups.com...

This is frustrating!!!!
Any help is mich appreciated.

My problem was that I was using the wrong timer. I was using the
System.Windows.Forms.Timer class rather than the System.Timers.Timer
Sep 5 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Nick White [MSFT] | last post: by
9 posts views Thread by scorpion53061 | last post: by
4 posts views Thread by Ryan | last post: by
3 posts views Thread by shapper | last post: by
1 post views Thread by =?Utf-8?B?cm9zczYxMw==?= | last post: by
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.