473,399 Members | 2,478 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.

Window Service Stopped

Greetings All,

This is my first time creating a Window Service and I am having this error message when I try to start my window service (currently known as Service1). Below is my code for Window Service and also the line which I suspected is the caused of the problem.

Expand|Select|Wrap|Line Numbers
  1. Protected Overrides Sub OnStart(ByVal args() As String)
  2.         Dim i As Integer
  3.         i = Shell("\\202.186.196.128\c$\Inetpub\wwwroot\WebAdmin\Rewards\print.exe", vbNormalFocus)
  4.         Dim fs As FileStream = New FileStream("c:\temp\mcWindowsService.txt", FileMode.OpenOrCreate, FileAccess.Write)
  5.         Dim m_streamWriter As StreamWriter = New StreamWriter(fs)
  6.         m_streamWriter.BaseStream.Seek(0, SeekOrigin.End)
  7.         m_streamWriter.WriteLine("BLPrinting Service: Service Started at " & Date.Now & Constants.vbLf)
  8.         m_streamWriter.Flush()
  9.         m_streamWriter.Close()
  10. End Sub
  11.  
  12. Protected Overrides Sub OnStop()
  13.         Dim fs As FileStream = New FileStream("c:\temp\mcWindowsService.txt", FileMode.OpenOrCreate, FileAccess.Write)
  14.         Dim m_streamWriter As StreamWriter = New StreamWriter(fs)
  15.         m_streamWriter.BaseStream.Seek(0, SeekOrigin.End)
  16.         m_streamWriter.WriteLine("BLPrinting Service: Service Stopped at " & Date.Now & Constants.vbLf)
  17.         m_streamWriter.Flush()
  18.         m_streamWriter.Close()
  19. End Sub
Above are the START and STOP functions for my Window Service, which I got it from some online tutorial. Since my window service is intended to call an EXE from a specific folder, hence I added in the 2 new lines, which I bolded. When I try to start my service again, it pops me this message:

The Service1 service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service.

For your information, my window service was working fine before I added in the 2 new lines of code. Maybe they way I'm supposed to call an EXE is incorrect. Please correct me if I'm wrong.

Thank you very much.

Best Regards
Gray d' Newbie
Aug 5 '08 #1
2 1719
jhardman
3,406 Expert 2GB
Is this ASP.NET (.aspx file extension) or classic ASP (.asp)?

Jared
Aug 6 '08 #2
Hi jhardman,

Is merely an ASP page

Thank you very much

Best Regards
Gray d' Newbie
Aug 11 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: BW | last post by:
Hi all! I'm not sure where to post this so I'm giving these a try. If there is a better (more appropriate) place to post please let me know. I want to create a service (in C#). The service's...
23
by: Adam Clauss | last post by:
I have a C# Windows Service running as the NetworkService account because it needs to access a network share. As part of the service's initialization, I want the service to terminate, if an...
3
by: Chris Hayes | last post by:
I'm trying to create a nifty Windows Service that will perform tasks at a predetermined interval. To make sure I understand the timing correctly I have set an emailer utility to email me on the...
6
by: Leonardo Curros | last post by:
Hello, I would like to know what's the best way to restart one service. I would like to do it from the service itself. Is this possible? I try it with ServiceController.stop()...
3
by: Kevin L | last post by:
How do I check to see if a particular service is running?
2
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello everyone, I have this application that stops and starts IIS admin. When I try to stop the service. I get an error "Cannot open IISADMIN service on computer '.'.". I tried changing the...
8
by: Lemune | last post by:
Hi, I'm developing window service application on C# 2005. The service is to read a new excel file on certain directory, and process it to database. The service work find on XP. But when I...
0
by: naveen babu | last post by:
hi, i have built a window service to send an email alert.. when i start the service..i get the following msg The ScheduleAlert service on Local Computer started and then stopped. Some...
9
by: mohitkumar | last post by:
Hello All, We have 3 windows services written in C#. We use them to process files from a folder into database and further to process the data into various SQL Tables. All the services hang...
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...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.