Salut à tous,
j'ai un soucis avec un service Windows, quand je lance en console(debug) ca fonctionne mais en service impossible de me connecter sur le serveur. Pour je n'ai pas de log d'erreur dans les journaux de windows.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 static void Main() { #if DEBUG Server S = new Server(); S.Start(); #else ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new ServiceTest() }; ServiceBase.Run(ServicesToRun); #endif }Si vous avez une idée... je désespère.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 class ServiceTest: ServiceBase { private Server Server = null; public ServiceTest() { this.InitializeComponent(); } private void InitializeComponent() { this.CanShutdown = true; this.ServiceName = "Service.Test"; } protected override void OnStart(String[] Args) { if (this.Server == null) { this.Server = new Server(); } this.Server.Start(); } protected override void OnStop() { if (this.Server != null) { this.Server.Stop(); } } protected override void OnShutdown() { if (this.Server != null) { this.Server.Stop(); } this.Server = null; } }
Merci d'avance.
Cordialement,
NeoKript
Partager