Start and stop windows services in axapta by code

To Start and stop service in axapta by code You first add  reference System.ServiceProcess in Application Object tree (AOT) on reference node after doing this you can add following code in job.

System.ServiceProcess.ServiceController ServiceController1 = new
 System.ServiceProcess.ServiceController();
     ;
     ServiceController1.set_MachineName(‘.’);
     ServiceController1.set_ServiceName("IISADMIN");
     ServiceController1.Stop();
     sleep(500);
     ServiceController1.Start();

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.