How to restart VC via PC SDK?

Hi!

I try to call Controller.Restart() method and get en exception telling me that I don’t have a right controller mastership. I have tried with mastership on configuration and on RAPID, no one is enough, so I just give up now and kindly ask you about a couple of C# rows to restart it.:stuck_out_tongue:
Thank you!

Hello Sergej,
Please try following code- Its working for me- PC SDK 5.12

class Program

{

static void Main(string args)

{Guid ctr_id=new Guid(“b4108096-c905-4a47-8c09-64bd84c84161”);

ControllerInfo cinfo=new ControllerInfo(ctr_id);

Controller _ctr = new Controller(cinfo);

try{ _ctr.Logon(UserInfo.DefaultUser);

using (Mastership.Request(_ctr.Rapid))

using (Mastership.Request(_ctr.Configuration))

_ctr.Restart(ControllerStartMode.Warm);

}

catch(System.Exception Exception)

{

Console.WriteLine(Exception.Message);

}

}

}

Hi! Thank you very much! It works!