camstar 服务健康检查和故障自动恢复
Posted lidezhen
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了camstar 服务健康检查和故障自动恢复相关的知识,希望对你有一定的参考价值。
新建控制台程序,引用camstar 的InsiteXmlclient
代码如下
class Program
{
static void Main(string[] args)
{
try
{
var sessionId = Guid.NewGuid().ToString("N");
var client = new csiClient();
var connection = client.createConnection("127.0.0.1", 2881);
var session = connection.createSession("CamstarAdmin", "mes++2020", sessionId);
var document = session.createDocument("EmployeeMaint");
var service = document.createService("EmployeeMaint");
var inputData = service.inputData();
inputData.namedObjectField("ObjectToChange").setRef("InsiteAdmin");
inputData.perform("Load");
service.setExecute();
service.requestData().requestField("CompletionMsg");
var reaponsDoc = document.submit();
if (reaponsDoc.checkErrors())
{
Console.WriteLine("验证用户失败");
}
else
{
Console.WriteLine("验证用户成功");
}
}
catch (Exception)
{
StartService();
}
}
static void StartService()
{
Process.Start(new ProcessStartInfo("net")
{
Arguments = "stop "InSite Server"",
UseShellExecute = false
});
Process.Start(new ProcessStartInfo("net")
{
Arguments = "start "InSite Server"",
UseShellExecute = false
});
}
}
编译生成
复制到服务器上添加计划任务
以上是关于camstar 服务健康检查和故障自动恢复的主要内容,如果未能解决你的问题,请参考以下文章