Restart service

zhaozj2021-02-16  34

Recently, the forum often hangs, it seems that IIS process system resources are too much; the server administrator has been in the weekend, can't restart IIS, depressed. The IIS of the 9CBS server may restart too often, and the sub-forum page is often not updated, and the post appears in the list is already sinking, or depressed.

Microsoft Knowledge Base Article Q194916 Restarting Web Services and Scheduled Tasks Weth A Batch File (http://support.microsoft.com/?kbid=194916) describes the method of restarting IIS with the command line, there is a network management who wants to lazy Try. The Sc.exe containing the tool in the platform SDK can make a more detailed configuration. If you use a program to restart IIS, you can use the ServicesTop and ServiceStart methods for the IShellDispatch 2 interface of the shell object. To use the shell object, you can call CocreateInstance to pass the CLSID CLSID_SHELL of the Shell object to create an object, then query its ISHELLDISPATCH / ISHELLDISPATCH2 and other interfaces for further operations. In addition, WMI Win32_ApplicationService also provides methods of control services StartService and STOPService. Cideguru has an example Using WMI to Extract Management Information (http://www.codeguru.com/cpp/w-p/system/misc/Article.php/c5675/). The advantage of WMI is that it can be managed remotely; the disadvantage is that it is more troublesome.

Of course, using the Windows service API is also possible - although it is not very concise to ControlService and StartService after OpenService. This is described in the example of the platform SDK in the platform SDK (http://msdn.microsoft.com/library/en-us/dllproc/base/sending_control_requests_to_a_service.asp) describes this. Use Windows Services APICHANGESERVICECONFIG and CHANGESERVICECONFIG2 to make more detailed configurations.

These methods can be applied to other services. To query the short name of the service, you can refer to Microsoft Knowledge Base Article Q271362 HOW to Find The Short Names of Services (http://support.microsoft.com/?kbid=271362) Reference Document Browse for a Folder The COM WAY (Visual C Developer, Aug. 1999)

More Windows 2000 UI Goodies: Extending Explorer Views By Customizing Hypertext Template Files (http://msdn.microsoft.com/msdnmag/issues/0600/w2kui2/default.asp)

转载请注明原文地址:https://www.9cbs.com/read-21425.html

New Post(0)