zoukankan      html  css  js  c++  java
  • 检测本机是否安装iis,netFramework,ASPNET

      //判断是否已经安装iis
            public static bool ExistSqlServerService(string tem)
            {
                bool ExistFlag = false;
                ServiceController[] service = ServiceController.GetServices();
                for (int i = 0; i < service.Length; i++)
                {
                    if (service[i].ServiceName.ToString() == tem)
                    {
                        ExistFlag = true;
                    }
                }
                return ExistFlag;
            }
      }
            //判断是否安装netFramework
            private static bool GetDotNetVersions()
            {
                bool result = false;
                DirectoryInfo[] directories = new DirectoryInfo(
                    Environment.SystemDirectory + @"..Microsoft.NETFramework").GetDirectories("v?.?.*");
                //string list = "";
                foreach (DirectoryInfo info2 in directories)
                {
                    //list +=info2.Name.Substring(0,4)+",";
                    if (info2.Name.Substring(0, 4) == "v3.5")
                    {
                        result = true;
                    }
    
                }
                return result;
            }
     //检测是否安装ASPnet,通过注册表
                string value = Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Components", "ASPNET", null).ToString();
             if (value != null )
                {
                    label12.Text += ",ASPNET已安装";
                }
  • 相关阅读:
    Pandas也能轻松绘图,简单而又漂亮
    笔试题: 二叉排序数左移k个
    补题next_permutation
    从HTTP到HTTPS
    HTTP首部字段详解
    HTTP请求方法及响应状态码详解
    HTTP报文格式详解
    TCP/IP网络基础
    Netty学习笔记
    ZooKeeper学习笔记
  • 原文地址:https://www.cnblogs.com/provedl/p/14468328.html
Copyright © 2011-2022 走看看