登录
首页 » 其他 » C#启动Windows IIS服务的实例

C#启动Windows IIS服务的实例

于 2022-02-13 发布 文件大小:37.23 kB
0 224
下载积分: 2 下载次数: 1

代码说明:

C#启动指定的Windows信使服务,本例中是启动IIS服务,在Windows XP下可完美运行,在Windows7下不行好像,本程序演示如何在C#的程序中启动一个指定的Windows内置服务的方法。具体的实现代码:   ServiceController service = new ServiceController();//创建服务控制对象   service.ServiceName = "Messenger";//启动Windows信史服务   //判断当前服务状态   if (service.Status == ServiceControllerStatus.Stopped)   {    try    {    service.Start();// 启动服务    service.WaitForStatus(ServiceControllerStatus.Running);    }    catch (InvalidOperationException)    {    MessageBox.Show("不能启动该服务!");    }   }

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • (本文是在论坛已有一篇文章《SIRP法相干相关K分布雷达杂波的建模与仿真》的基础上修改而来,在此首先感谢这篇文章的作者给予我的帮助。之所以完成这篇文章,有三个方...
    (本文是在论坛已有一篇文章《SIRP法相干相关K分布雷达杂波的建模与仿真》的基础上修改而来,在此首先感谢这篇文章的作者给予我的帮助。之所以完成这篇文章,有三个方面的原因:一是对原文章和仿真程序代码明显存在一些不一致的地方,因此,我这里对每个公式进行检验(后来证明文章的公式正确无误,但所给的仿真代码存在问题),二是对自己近4天工作的一个总结,以便以后学习可以参考;三是可以放在网上给初学者一些参考,以便后来者不再走自己曾经走过的弯路。文章的一些文字是在匆忙间完成,只求能表达所述意思,没有详细斟酌,海涵:-(This article is an article in the forum have been "SIRP law related coherent K distributed clutter radar modeling and simulation" on modified from the foundation, in this first of all thank the authors of this article has given me help. The reason why the completion of this articles, there are three reasons: First, the original article and simulation program code, there are some obvious inconsistencies, so I here the formula for each test (later proven formula article is correct, but give the simulation code problem exist), near two of their four days of a summary of the job in order to study the future reference three on-line can give some reference for beginners in order to go was no longer the tortuous path they have traversed. arti
    2022-06-17 14:10:51下载
    积分:1
  • JSP ExtJS图书管理系统
    JSP ExtJS图书管理系统,ExtJS 2.2+Java+TOMCAT5+MSSQL2000+SP4初次完工的图书管理WEB项目,主要是结合EXTJS是亮点,功能方面主要是一些JSP与SQL数据库的操作,代码方面,包括了所有的JAVA源码文件,最好能调试起来,结合功能学习下效果更好。
    2022-01-21 05:14:05下载
    积分:1
  • 连连看得源码,可以用作学习和研究之用,中的有些处理值得借鉴...
    连连看得源码,可以用作学习和研究之用,其中的有些处理值得借鉴-source can be used for learning and research purposes, which should draw on some handling
    2022-09-10 18:55:03下载
    积分:1
  • 该文件是基于labview开发的一个虚拟示波器,有需要的可以来
    该文件是基于labview开发的一个虚拟示波器,有需要的可以来-The document is based on the LabVIEW development of a virtual oscilloscope, are in need can come
    2022-02-21 13:52:03下载
    积分:1
  • Flash电子相册格子版
    Flash电子相册格子版,最开始打开的时候,显示为格子,单击格子,则显示为对应的大图片,看上去十分唯美的感觉,可把本效果应用于其它的图片展示效果中。
    2023-05-06 17:55:03下载
    积分:1
  • 定期提醒(可安装:警告;建议和关机;直接等。
    定时提醒(可设:提醒;提醒并关机;直接关机;定时执行一程序等。是家长们控制孩子玩电脑的好帮手。-regularly reminded (can be installed : Warning; Advised and shutdown; Directly elected; Timing implementation of a procedure. parents controlled their children playing with the computer"s helping hands.
    2022-02-01 00:23:38下载
    积分:1
  • XML入门的最佳文章系列,感觉非常棒,通俗易懂。强烈推荐。...
    XML入门的最佳文章系列,感觉非常棒,通俗易懂。强烈推荐。-XML portal of the best series of articles, I feel terrific, and simple to understand. Strongly recommended.
    2022-05-23 22:21:41下载
    积分:1
  • 三洋FM模块的原代码,调试通过了的,很好用的,欢迎大家下载
    三洋FM模块的原代码,调试通过了的,很好用的,欢迎大家下载-Sanyo FM module source code, debugging adopted, and a good use, and welcome everyone to download
    2022-01-26 06:57:24下载
    积分:1
  • Delphi印章制作图章工具源码
    Delphi印章制作图章工具源码,来自Delphi盒子的一个源码,可实现圆形、椭圆形、菱形、方形、三角形等不同形状的印章图案。可对印章图案进行不同比例缩放、翻转模糊、透明处理、亮度/对比度/饱和度/海绵/陨化(磨砂)/锐化/反相/浮雕等多种特效处理,最后还可把印章导出等。
    2022-07-25 18:41:41下载
    积分:1
  • 文本编辑框
    文本编辑框-------------------简易-Text edit box- Summary
    2022-02-11 11:25:10下载
    积分:1
  • 696516资源总数
  • 106436会员总数
  • 7今日下载