I believed that a service running - like any other process - locks its executable file (as in use).

In fact I need to stop the service when I build a new version of it in Visual Studio and then I start it again.

I don't understand how they updated the executable without stopping the service (during a deploy) and then - afterwards - they just restarted the service for the changes to take effect.

Anyone has an explanation to this?

  • Use SC command. Stop service: sc stop service_name then change executable: sc create service_name binPath= abc.exe then start the service sc start service_name – Biswapriyo Sep 1 '17 at 9:26

Actually the file cannot be deleted (or similarly you can't overwrite the very same file), but can be renamed or moved.

So, in this way, it can be replaced.

Similar question here (showing surprise for this behaviour indeed).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.