zoukankan      html  css  js  c++  java
  • [C#][EntLib]服务为何会依赖于WMI Performance Adapter服务

     

    [C#]服务为何会依赖于WMI Performance Adapter服务

    编写者

    日期

    关键词

    郑昀@ultrapower

    2005-6-13

    Service C# Cache

    “WMI Performance Adapter”

    “Microsoft Enterprise Library”

     

    现象

    我们的C#编写的Windows ServiceCommandListener”在Windows 2000上运行正常,但是在Windows 2003上却总是依赖于“WMI Performance Adapter”服务的启动。

    而“WMI Performance Adapter”服务一般是手动启动的,这样就导致服务器重启之后,“CommandListener”服务没有能够自动启动。

    但是却找不到是哪一个部分依赖于这个“WMI Performance Adapter”。

     

    经过逐个排查,确定是添加了对“Microsoft Enterprise Library”的“Microsoft.Practices.EnterpriseLibrary.Caching.dll”的使用导致的。

    探求究竟

    System.Management.Instrumentation引发的

    由于Microsoft.Practices.EnterpriseLibrary.Caching工程中,有对“System.Management.Instrumentation”的引用。

    而这个“System.Management.Instrumentation”命名空间提供一些类,提供在规范应用程序管理并通过 WMI 向潜在使用者公开管理信息和事件时必需的类。这样,Microsoft Application Center Microsoft Operations Manager 等使用者就可以轻松地管理您的应用程序,而管理员脚本或其他应用程序(托管应用程序和非托管应用程序)也可以监视和配置您的应用程序。

    也就是说,正是因为Microsoft.Practices.EnterpriseLibrary.Caching,所以为服务引入了“WMI Performance Adapter”服务的依赖性。

    解决办法:

    由于没办法通过Cache自身的配置解除对“WMI Performance Adapter”服务的依赖,我们只能主动给“CommandListener”服务加上相关服务依赖性,这样让我们的服务能够成功自动启动。

     

    通过以下代码,就可以:

    Code

    [RunInstaller(true)]

         public class ProjectInstaller : System.Configuration.Install.Installer

         {

             private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;

             private Verifide.ServiceUtils.ServiceInstallerEx serviceInstaller1; this.serviceInstaller1.ServicesDependedOn = new string[] {

                                                                    "WMI Performance Adapter"};

     

    编写者

    日期

    关键词

    郑昀@ultrapower

    2005-6-13

    Service C# Cache

    “WMI Performance Adapter”

    “Microsoft Enterprise Library”

     

  • 相关阅读:
    RPI学习--环境搭建_更新firmware
    RPI学习--环境搭建_刷卡+wiringPi库安装
    [转]VS2005 Debug时提示"没有找到MSVCR80D.dll"的解决办法
    [转]结构体字节对齐
    [转]C++运算优先级列表
    putty基本操作
    Go 修改字符串中的字符(中文乱码)
    Go part 5 结构体,方法与接收器
    pickle 和 base64 模块的使用
    原来还有 卡夫卡 这个人存在
  • 原文地址:https://www.cnblogs.com/zhengyun_ustc/p/173586.html
Copyright © 2011-2022 走看看