zoukankan      html  css  js  c++  java
  • c#如何写服务,打包和卸载服务

    Service.cs  每隔一分钟进行一次数据操作

       public Service1()
            {
                InitializeComponent();
                System.Timers.Timer mtimer = new System.Timers.Timer();
                mtimer.Elapsed += new System.Timers.ElapsedEventHandler(mtimer_Elapsed);
                mtimer.Enabled = true;
                mtimer.Interval = 1000*60;
            }

            void mtimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
            {
                dolog("抓取数据");
                GetData();//数据操作部分
            }

            protected override void OnStart(string[] args)
            {
                dolog("服务运行");//记录日志
            }

            protected override void OnStop()
            {
                dolog("服务停止");//记录日志
            }

    安装和卸载

    1输入cmd命令

    2 cd C:/Windows/Microsoft.NET/Framework/v2.0.50727

    3输入InstallUtil.exe 路径//安装

    4输入InstallUtil.exe -u 路径//卸载

    每天积累一点,离成功就近一点
  • 相关阅读:
    static&初始化顺序
    java基础语法
    MySQL调优
    Nnginx调优
    cisco 一些基本命令
    路由器密码忘记
    利用GetPrivateProfileString读取配置文件(.ini)
    MFC中OnActivate函数解析
    在MFC应用程序中传输的消息类型
    MFC中UpdateData函数解析
  • 原文地址:https://www.cnblogs.com/apes-monkeys/p/4058987.html
Copyright © 2011-2022 走看看