引言: 在.net中提供了一些类来显示和控制Windows系统上的服务,并可以实现对远程计算机服务服务的访问,如System.ServiceProcess命名空间下面的ServiceController 类,System.Management下面的一些WMI操作的类。
摘要:
wednesday, october 13, 2004
浮点数的比较运算
对浮点数进行比较,必须先舍入为相同精度再进行,因其的不精确性。
在需要测试某个float值或double值是否为无穷大或nan时,不能直接用single或double结构中的positiveinfinity、negativeinfinity或nan字段进行比较;应选用isinfinity......
摘要:november 19, 2003t-sql programming part 3 - processing sequentially through a set of recordsby gregory a. larsen
at some point you will have some business logic that will require you to process seq......
使用C#控制远程计算机的服务 在.net中提供了一些类来显示与控制windows系统上的服务,并可以实现对远程计算机服务服务的访问,如system.serviceprocess命名空间下面的servicecontroller 类,system.management下面的一些wmi操作的类.虽然用servicecontroller可以很方便的实现对服务的控制,而且很直观.简洁与容易理解.但是我认为他的功能同通过wmi来操作服务相比,那可能就有些单一了,并且对多个服务的操作可能就比较麻烦,也无法列出系统中的所有服务的具体数据.这里要讲的就是如何使用system.management组件来操作远程与本地计算机上的服务. wmi作为windows 2000操作系统的一部分提供了可伸缩的,可扩展的管理架构.公共信息模型(cim)是由分布式管理任务标准协会(dmtf)设计的一种可扩展的.面向对象的架构,用于管理系统.网络.应用程序.数据库与设备.windows管理规范也称作cim for windows,提供了统一的访问管理信息的方式.如果需要获取详细的wmi信息请读者查阅msdn.system.management组件提供对大量管理信息与管理事件集合的访问,这些信息与事件是与根据 windows 管理规范 (wmi) 结构对系统.设备与应用程序设置检测点有关的. 【程序编程相关:
Reference and Except】 【推荐阅读:
使用PB调用API自动更新(非FTP模式】 但是上面并不是我们最关心的,下面才是我们需要谈的话题. 【扩展信息:
UML学习笔记】 毫无疑问,我们要引用system.management.dll程序集,并要使用system.management命名空间下的类,如managementclass,managementobject等.下面用一个名为win32servicemanager的类把服务的一些相关操作包装了一下,代码如下: using system; using system.management; namespace zz.wmi { public class win32servicemanager { private string strpath; private managementclass managementclass; public win32servicemanager():this(".",null,null) { } public win32servicemanager(string host,string username,string password) { this.strpath = "\\\\"+host+"\\root\\cimv2:win32_service"; this.managementclass = new managementclass(strpath); if(username!=null&&username.length>0) { connectionoptions connectionoptions = new connectionoptions(); connectionoptions.username = username; connectionoptions.password = password; managementscope managementscope = new managementscope( "\\\\" +host+ "\\root\\cimv2",connectionoptions) ; this.managementclass.scope = managementscope; } } // 验证是否能连接到远程计算机 public static bool remoteconnectvalidate(string host,string username,string password) { connectionoptions connectionoptions = new connectionoptions(); connectionoptions.username = username; ...
下一页 摘要: 在多道程序环境下,存在着临界资源,它是指多进程存在时必须互斥访问的资源。也就是某一时刻不允许多个进程同时访问,只能单个进程的访问。我们把这些程序的片段称作临界区或临界段,它存在的目的是有效的防止竞争条件又能保证最大化使用共享数据。而这些并发进程必须有好的解决方案,才能防止出现以下情况:多个进程同时处于临界区,临界区外的进程阻塞其他的进程,有些进程在临界区外无休止的等待。除此以外,这些方案还不能对......