33

I have written a Windows service in C#.

I have since installed it on my machine, and it runs just fine.

When you install a service, does the exe get copied somewhere? Or does it point to my bin folder?

This is for me to know that when I update my code from time to time, do I have to uninstall and re-install my service to update it?

J0e3gan
8,96810 gold badges58 silver badges81 bronze badges
asked Mar 4, 2014 at 3:46
2
  • I would Create Setup project to install the windows service. Commented Mar 4, 2014 at 3:54
  • No, the InstallUtill.exe uses the original executable path when creating the service. As @Riz stated you can check the path from services.msc. Commented Nov 23, 2018 at 14:29

3 Answers 3

44

If you want to update your Service automatically, you can use a framework such as Google Omaha. This is the technology which Google use to update Chrome. It works well with Services because it runs silently in the background, just like a Service. This article gives more information about using Omaha to auto-update a Service.

On the other hand, if you want to manually update your Service: If the Service's location has not changed and the name of its executable has not changed, you should not have to uninstall and reinstall it. You can simply stop the service with net stop, update its executable with a new version, and start it again with net start. This approach worked reliably for me for many months.

Michael Herrmann
5,0433 gold badges41 silver badges55 bronze badges
answered Mar 4, 2014 at 4:00
Sign up to request clarification or add additional context in comments.

Comments

3

You can check the path of installed service by opening services.msc from Run. Then right click your service and see the 'Path to executable'.

If this points to your bin directory, then it will be updated every time you compile successfully.

enter image description here

answered Mar 4, 2014 at 3:54

1 Comment

Hi can you help? I am modifying my Windows Service and have rebuild my project but my exe file still is not getting updated. Last time, I modified something in my service, and rebuild the project my exe file got automatically updated. You will know when it shows you the latest time . But this time it's not working. I have tried so many thing.
3

You should uninstall the old windows service and install new version of windows service.

uninstall:

 installutil /u yourproject.exe

install:

 installutil yourproject.exe
answered Mar 4, 2014 at 3:56

2 Comments

This goes against the other answers here. Can you provide more info?
I agree with this answer, as changing the binary does not work, especially not, when the file version changes.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.