• 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
                });
            }
        }
    

    编译生成
    复制到服务器上添加计划任务

     

     

  • 相关阅读:
    python_Memcached
    python_day10_IO多路复用
    java_list,set,map集合
    python3.0_day9_scoket基础之篇
    redis.conf配置文件详解
    Java_数组
    面向接口编程初识(转)
    SSH三种框架及表示层、业务层和持久层的理解(转)
    解决win10磁盘占用过大的问题(亲测有效)
    ORA-12541:TNS:无监听程序
  • 原文地址:https://www.cnblogs.com/lidezhen/p/13232880.html
Copyright © 2020-2023  润新知