Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to install windows service on my local computer

Posted on 2006-03-21
6
Medium Priority
?
202 Views
Last Modified: 2010-04-23
Hi Experts,
Can you please tell me How to install windows service on my local computer?
i was trying to install it using projectInstaller
i dont know why it is not working...
I also created same exact application as a windows application to see if there is a problem in the application but the application is running fine and does what i need it to do... in short.

For windows service i have created following all the work is done in Timer1_Elapsed function


Imports System.ServiceProcess
Imports System.IO
Imports System.IO.FileSystemEventArgs
Imports System.Configuration

Protected Overrides Sub OnStart(ByVal args() As String)
          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_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
        Dim strFilesPath As String
        strFilesPath = ConfigurationSettings.AppSettings.Get("FilesPath")
       
      Dim oldFileName As String
        Dim newFileName As String

' HERE I HAVE CODE TO GET MY oldFilename and NewFilename

        For Each fl In fls
             Rename(strPath + oldFileName, strPath + newFileName)
        Next
    End Sub
End Class
0
Comment
Question by:Junior_Developer
  • 2
  • 2
  • 2
6 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 16251295
don't you think you should call Timer1_Elapsed from OnStart event of your service?
0
 
LVL 35

Expert Comment

by:YZlat
ID: 16251305
what does Timer1.Start() do?
0
 

Author Comment

by:Junior_Developer
ID: 16251428
Well please guide me...
all the functionality that need to be done is in Timer1_Elapsed.
Timer1.start() will just starts the timer and i am thinking after that timer1_elapsed is called so i put my functionality in elapsed please let me know if you think i need to change it.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Accepted Solution

by:
sara110 earned 2000 total points
ID: 16251498
timer1 should be at first enable=false then with starting ur service it should change to true and with stop change to false
Protected Overrides Sub OnStart(ByVal args() As String)
          Timer1.enable=true

End Sub

Protected Overrides Sub OnStop()
        ' Add code here to perform any tear-down necessary to stop your service.
        Timer1.enable=false

End Sub
0
 

Author Comment

by:Junior_Developer
ID: 16251613
The functionality that i am using where should i write it after adding timer1.enable = true in onstart and timer1.enable = false in onStop.
Do i still keep it in timer_elapsed() ?
0
 
LVL 6

Expert Comment

by:sara110
ID: 16266214
no, in windows service you have two sub routine one is Onstart and the other is Onstop you should write your code there,  by the way, if your window service call any local file , you should give it full path of your local file or put that file in system32 unless your service will fail. the way you could be able to know the window service error is write in eventlog. in this way you could be able to understand its error too.
good luck
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month10 days, 16 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question