Windows Service Question

I have 3 windows service questions

  • Can WS run in the background? Is it possible to do some work every 2 minutes? (if so, can I get help?)

  • How to install WS in an easy way? (not with Installutil.exe .......)

  • How can I run a .exe file from a windows service?

I tried this way:

System.Diagnostics.Process G = new Process();
    G.StartInfo.FileName = @"d:\demo.exe";
    G.Start();

but it didn’t work.

+3
source share
6 answers
  • , Windows . 2 system.Timer onElapsed. , , , , onElapsed.

  • InstallUtil.exe, .bat , , .

.exe Windows, .exe Windows, :

Process p = new Process();
p.StartInfo.WorkingDirectory = @"C:\";
p.StartInfo.FileName = @"C:\demo.exe";
p.StartInfo.CreateNoWindow = true;
p.Start();
p.WaitForExit();

, , , , - . .exe , , .exe . ( , SO - (.EXE) #)

+2
  • , Timer class ()

  • installutil.exe? , VS.NET, installutil.exe , . ( 1, 2)

+6

Windows . , , .

System.Threading.Timer , .

, Installutil.exe - Windows.

. , , . , , Installutil, "" .

+4

VS2008, Windows.

, (System.Windows.Timers.Timer), OnStart, OnStop (OnStart OnCommand )

, ,

, , ,

+2

sc.exe , InstallUtil.exe . .

, sc.exe. sc .

+1

, , .

0

Source: https://habr.com/ru/post/1706353/


All Articles