OVH Cloud OVH Cloud

service Windows avec DotNet

2 réponses
Avatar
Jean yves
Bonjour ,

j'essai d'implementer un service windows avec C# , tout a l'aire de bien
fonctionner , sauf une petite chose .
lorsque j'envoi une commande au service via un autre programme , comme ceci
TheController.ExecuteCommand (command) ;

l'argument "command" est un int32 , mais cela ne fonctionne que pour
certaines valeurs du parametre "command"

par exemple ca fonctionne tres bien pour des valeurs 200 , 201 , 210, 220
etc ... , par contre

ca genere un exception "InvalidArgument" pour des valeurs comme 0, 1, 700,
755 etc

si quelqu'un a deja implementer un service windows et qui s'y connait un peu
, ca serais sympa de m'eclairer ,

2 réponses

Avatar
Paul Bacelar
"Jean yves" wrote in message
news:
Bonjour ,

j'essai d'implementer un service windows avec C# , tout a l'aire de bien
fonctionner , sauf une petite chose .
lorsque j'envoi une commande au service via un autre programme , comme


ceci
TheController.ExecuteCommand (command) ;

l'argument "command" est un int32 , mais cela ne fonctionne que pour
certaines valeurs du parametre "command"

par exemple ca fonctionne tres bien pour des valeurs 200 , 201 , 210, 220
etc ... , par contre

ca genere un exception "InvalidArgument" pour des valeurs comme 0, 1, 700,
755 etc

si quelqu'un a deja implementer un service windows et qui s'y connait un


peu
, ca serais sympa de m'eclairer ,





Restez dans les clous ;-) (entre 128 et 255)

Instead, a Windows Service's standard interface allows for a "custom
command." This is a command sent to the Windows Service in the form of a
numeric code. The code can be any number between 128 and 255. (The operating
system reserves numbers under 128.) A custom command is sent to a service
with the ServiceController's ExecuteCommand method. The command is then
received in an event inside the service called the OnCustomCommand event.

--
Paul Bacelar
Avatar
Jean yves
ah ok ok ok :-)

"Paul Bacelar" a écrit dans le message
de news: #
"Jean yves" wrote in message
news:
> Bonjour ,
>
> j'essai d'implementer un service windows avec C# , tout a l'aire de bien
> fonctionner , sauf une petite chose .
> lorsque j'envoi une commande au service via un autre programme , comme
ceci
> TheController.ExecuteCommand (command) ;
>
> l'argument "command" est un int32 , mais cela ne fonctionne que pour
> certaines valeurs du parametre "command"
>
> par exemple ca fonctionne tres bien pour des valeurs 200 , 201 , 210,


220
> etc ... , par contre
>
> ca genere un exception "InvalidArgument" pour des valeurs comme 0, 1,


700,
> 755 etc
>
> si quelqu'un a deja implementer un service windows et qui s'y connait un
peu
> , ca serais sympa de m'eclairer ,
>
>

Restez dans les clous ;-) (entre 128 et 255)

Instead, a Windows Service's standard interface allows for a "custom
command." This is a command sent to the Windows Service in the form of a
numeric code. The code can be any number between 128 and 255. (The


operating
system reserves numbers under 128.) A custom command is sent to a service
with the ServiceController's ExecuteCommand method. The command is then
received in an event inside the service called the OnCustomCommand event.

--
Paul Bacelar