Показать сообщение отдельно
Старый 31.03.2008, 16:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
dax-lessons: Stopping and starting services using x++
Источник: http://DAX-Lessons.spaces.live.com/B...FCD1!141.entry
==============


This short code snippet shows how you can access the status of any windows services using X++. Also, it is easy to start and stop windows services programmatically.

Before you start running the code, you need to add reference System.ServiceProcess from the AOT references node.

Note : Get_status() method is used to get the status of the service. Code can be modified according to the status of the service.

[FONT='Calibri]static void start_stop_Service(Args _args)
{
    System.ServiceProcess.ServiceController controller = new System.ServiceProcess.ServiceController();
    ;
    controller.set_MachineName('.');
    controller.set_ServiceName("IISADMIN");
    controller.Stop();
    sleep(500);
    controller.Start();
}
[/FONT]



Источник: http://DAX-Lessons.spaces.live.com/B...FCD1!141.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.