473,399 Members | 3,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Help creating Windows Service .net studio 2005

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("t...@test.com",
"tom.mil...@gmail.co.uk", _
"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.

Sep 4 '07 #1
2 1758

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

<snipped>
>
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...

<snipped>
This is frustrating!!!!
Any help is mich appreciated.
<snip>

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
class.
Sep 5 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nick White [MSFT] | last post by:
Hello fellow Microsoft Windows Mobile and Embedded enthusiasts: I invite you to peruse the list below of upcoming technical chats and Webcasts offered by the Windows Mobile and Embedded Devices...
2
by: Val3 | last post by:
Hi all. I need to build dll(s) and windows services using VB .NET 2005 Express. When I make File/New project the windows contain only Windows application, Windows control library, Console...
9
by: scorpion53061 | last post by:
I have a request of Microsoft and I hope they see this. I use Visual Studio 2005 Pro and WIN XP Pro with IIS 5.1 I have spent the better part of the last 2 weeks attempting to get my ASP.NET...
4
by: Ryan | last post by:
I'm trying to create a report (similar to access) in VB 2005. It appears that Crystal Reports is the recommended method. I created a Crystal Report, set up the data connection (using the Wizard...
1
by: NathanC | last post by:
I am trying to create a simple service since and have never done this before. I have created a new project in VB.NET that is a Windows Service. (Just writing a single event entry to the log, just...
3
by: shapper | last post by:
Hello, In have a class inside a compiled DLL where I have the following code: ' Create site map XML document Dim siteMap As XmlDocument = New XmlDocument ' Load site map XML document from...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
4
by: Dica | last post by:
we just ordered VS 2005 standard edition. i was reading up on creating windows services and apparently this is only possible with the enterprise edition. is this true, or does it simply mean...
1
by: =?Utf-8?B?cm9zczYxMw==?= | last post by:
I'm puzzled by an error message encountered while creating a Windows Service. In particular, I'm creating a second Windows Service within a Windows Service project, using Visual Studio 2005. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.