zoukankan      html  css  js  c++  java
  • HTTP Analyzer 伴侣,解决Probably another instance is already up

    解决方案1:

    NET START HttpAnalyzer_StdV7_NetFilter
    START start HttpAnalyzerStdV7.exe
    将以上内容保存为.bat

    解决方案2:

     public static void Stat()
            {
                //检查是否包含此服务
                if (ISWindowsServiceInstalled("HttpAnalyzer_StdV7_NetFilter1"))
                {
                    if (!ISStart("HttpAnalyzer_StdV7_NetFilter"))
                    {
                        StartService("HttpAnalyzer_StdV7_NetFilter");
                    }
                    Process.Start("HttpAnalyzerStdV7.exe");
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("不存在服务,请安装服务。");
                }
            }
            /// <summary>
            /// 判断是否安装了某个服务
            /// </summary>
            /// <param name="serviceName"></param>
            /// <returns></returns>
            public static bool ISWindowsServiceInstalled(string serviceName)
            {
                try
                {
                    ServiceController[] services = ServiceController.GetServices();
                    foreach (ServiceController service in services)
                    {
                        if (service.ServiceName == serviceName)
                        {
                            return true;
                        }
                    }
    
    
                    return false;
                }
                catch
                { return false; }
            }
    
            /// <summary>
            /// 判断某个服务是否启动
            /// </summary>
            /// <param name="serviceName"></param>
            public static bool ISStart(string serviceName)
            {
                bool result = true;
                try
                {
                    ServiceController[] services = ServiceController.GetServices();
                    foreach (ServiceController service in services)
                    {
                        if (service.ServiceName == serviceName)
                        {
                            if ((service.Status == ServiceControllerStatus.Stopped)
                                || (service.Status == ServiceControllerStatus.StopPending))
                            {
                                result = false;
                            }
                        }
                    }
                }
                catch { }
                return result;
            }
    
            /// <summary>
            /// 启动某个服务
            /// </summary>
            /// <param name="serviceName"></param>
            public static void StartService(string serviceName)
            {
                try
                {
                    ServiceController[] services = ServiceController.GetServices();
                    foreach (ServiceController service in services)
                    {
                        if (service.ServiceName == serviceName)
                        {
                            service.Start();
                            service.WaitForStatus(ServiceControllerStatus.Running, new TimeSpan(0, 0, 30));
                        }
                    }
                }
                catch { }
            }
    

    以上两种方案必须放到HTTPAnalyzerFull安装目录才可以运行。

    附上源码:

    下载

  • 相关阅读:
    在MPTCP中引入流量监控——bwm-ng的使用说明
    Ubuntu下配置MPTCP
    实现两台MPTCP主机之间的通信——VSFTPD的配置与使用
    Google 辟谣,Android 和 Chrome OS 不合并
    paper-7
    计算机网络方面国际三大顶尖会议
    谷歌物联网操作系统Android Things揭开面纱
    张纯如
    Android binder机制之 5 --(创建binder服务)
    【BZOJ 1491】[NOI2007]社交网络
  • 原文地址:https://www.cnblogs.com/tom-cat/p/6794704.html
Copyright © 2011-2022 走看看