How to install windows service on my local computer

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
Junior_DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

YZlatCommented:
don't you think you should call Timer1_Elapsed from OnStart event of your service?
0
YZlatCommented:
what does Timer1.Start() do?
0
Junior_DeveloperAuthor Commented:
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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

sara110Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Junior_DeveloperAuthor Commented:
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
sara110Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.