Answer the question
In order to leave comments, you need to log in
Activity of only 1 application in the system and support for its performance
There is a task: run a program (Windows, .NET) on a certain number of PCs and keep it always active (that is, it should start again when it crashes), update support is required (Click-once is supposed to be used) and statistics are collected locally for subsequent sending to the server.
There will be no access to the machines after installation, so any bug / lack of logs is fraught with a lot of headaches.
In general, the task itself is standard, I would like to see a list of pitfalls that we may encounter - at least in terms of launch-update.
Or at least tell me what words to google for :)
Thank you.
Answer the question
In order to leave comments, you need to log in
Generally. The application should not “fall”;)
If you want the program to start again when the user shoots it in a more sophisticated way than through the task manager, then it simply won’t work here (you need to create a service that will monitor the application, and the application must monitor the service and restart each other, but this user will be able to win, but it is already much more difficult.And the service, if I'm not mistaken, can't be installed via ClickOnce).
Otherwise, monitor the user exit event and catch any unhandled exceptions (AppDomain.CurrentDomain.UnhandledException, Application.ThreadException for WinForms, for example) and restart the application in this case.
It seems to me that it is worth dividing such software into at least two components. The first is the program itself, which performs useful functionality, writes a log of its work. The second component is a service that monitors the state of the first component, restarts it if necessary, checks for software updates and configs on the server, updates, sends statistics and error logs to the server.
As for the pitfalls - from my own experience - you should not run many copies of the software at the same time :) That is, you should clearly define the condition for running / not running the program and check its correctness. I myself once incorrectly compiled a logical condition in a PowerShell script. The server's memory was full and it hung. Although there was remote access to the car, I still had to go to the scene. Then for a long time I caught the place of the error.
Separately, the update service, separately - monitoring + restart, separately sending logs.
The number of running copies can also be limited.
you can hang up the launch of the program instead of explorer, but then it will be necessary to provide policies for disabling ctrl-alt-del/taskman and other (unallowed) programs.
But you need to take into account that when there is physical access to the system, local and group policies, as well as the password for the admin account, are reset elementarily.
Why don't you like the option to run through the windows scheduler on a schedule every n minutes and check the box that if 1 instance is already running, then do not start the second one?
I'm not sure exactly what you want, but this option without writing code at least and can be just as effective.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question