473,376 Members | 1,028 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,376 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 1756

<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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.