469,270 Members | 1,244 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

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("\\\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
  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 1595
3,406 Expert 2GB
Is this ASP.NET (.aspx file extension) or classic ASP (.asp)?

Aug 6 '08 #2
Hi jhardman,

Is merely an ASP page

Thank you very much

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

Post your reply

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

Similar topics

7 posts views Thread by BW | last post: by
23 posts views Thread by Adam Clauss | last post: by
3 posts views Thread by Chris Hayes | last post: by
6 posts views Thread by Leonardo Curros | last post: by
3 posts views Thread by Kevin L | last post: by
2 posts views Thread by =?Utf-8?B?Vmlua2k=?= | last post: by
reply views Thread by naveen babu | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.