1、Windows服务安装

通过cmd运行指令安装Windows服务:

安装方法:运行cmd,以InstallUtil.exe 来运行 Windows服务程序。

如果是Release模式的话,直接在cmd窗口粘贴指令 C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe "D:\Project Files\MailSendAuto\MailSendAuto\bin\Release\MailSendAuto.exe"
        如果是Debug模式的话,直接在cmd窗口粘贴指令 C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe "D:\Project Files\MailSendAuto\MailSendAuto\bin\Debug\MailSendAuto.exe"

其中“v4.0.30319”是根据Windows Service程序集版本而定,另外还有v3.5、v3.0、v2.0.50727等等

问题列表(Win8 + Visual Studio 2010):

错误提示1:无法打开计算机上"."服务器控制器,此操作可能需要其他特权。。。。错误消息如下:拒绝访问。。。正在执行回滚。。。安装失败,已执行回滚

解决办法:很明显应该是跟系统权限等有关。不要直接Win+R运行cmd,应该以管理员身份运行 C:\Windows\System32\cmd.exe,并执行安装指令

错误提示2:未能加载文件或程序集或他的某一个依赖项。系统找不到指定的文件。

解决办法:低级错误,粗心大意造成的后果。cmd执行的指令中,Windows服务路径 D:\...\MailSendAuto.exe 未加双引号。

2、Windows服务卸载

以管理员身份运行 C:\Windows\System32\cmd.exe ,执行指令:sc delete WinServiceTest(Windows服务名称)。

3、Windows服务调试。

用管理员身份启动Visual Studio 2010,打开Windows服务,在Debug模式下编译成功后,安装Windows服务,并启动。

然后点击 工具栏—>附加到进程,就可以在可用进程列表中找到对应的Windows服务名称,选择并附加。然后就可以断点调试了

WindowsService - 开发遇到的问题的更多相关文章

  1. WindowsService开发简单入门

    参考网址: https://www.cnblogs.com/wenlong512/p/7355971.html 一.简介 程序创建在 Windows 会话中,可长时间运行的可执行应用程序.这些服务可以 ...

  2. WindowsService开发遇到的问题

    1.Windows服务安装 通过cmd运行指令安装Windows服务: 安装方法:运行cmd,以InstallUtil.exe 来运行 Windows服务程序. 如果是Release模式的话,直接在c ...

  3. WindowsService(Windows服务)开发步骤附Demo

    1.打开VS,新建项目,选择Windows服务,然后设置目录及项目名称后点击确定. 2.展开Service1服务文件,编写service1.cs类文件,不是Service1[设计].然后修改OnSta ...

  4. WindowsService(Windows服务)开发步骤附Demo 【转】

    转http://www.cnblogs.com/moretry/p/4149489.html 1.打开VS,新建项目,选择Windows服务,然后设置目录及项目名称后点击确定. 2.展开Service ...

  5. [开发笔记]-WindowsService服务程序开发

    Windows服务:Microsoft Windows 服务(即,以前的 NT服务)使您能够创建在它们自己的 Windows 会话中可长时间运行的可执行应用程序.这些服务可以在计算机启动时自动启动,可 ...

  6. WindowsService服务程序开发

    Windows服务:Microsoft Windows 服务(即,以前的 NT服务)使您能够创建在它们自己的 Windows 会话中可长时间运行的可执行应用程序.这些服务可以在计算机启动时自动启动,可 ...

  7. WindowsService服务程序开发 安装和卸载

    安装服务:installutil.exe E:\XTestDemo\X_15_WindowsService\bin\Debug\X_15_WindowsService.exe 卸载服务:install ...

  8. WindowsService(Windows服务)开发步骤

    https://www.cnblogs.com/moretry/p/4149489.html

  9. .net开发windows服务小结

        今天学习了在.net下创建一个windows服务,总结一下学习心得.     开发环境:visual studio 2012   一.编写程序 (1)创建一个空解决方法 (2)添加一个控制台应 ...

随机推荐

  1. SOAP消息结构

    邵盛松 2012-5-22 一 SOAP消息结构 SOAP消息包括以下元素 必需的 Envelope 元素,可把此 XML 文档标识为一条 SOAP 消息,XML文件的顶层元素,代表该文件为SOAP消 ...

  2. Log4net.confager配置

    <?xml version="1.0" encoding="utf-8"?><log4net>  <level value=&qu ...

  3. IE block my cookie in iframe

    ---恢复内容开始--- There is a severe bug that a leader figured it out in a published project. In IE11, the ...

  4. [AngularFire 2] Push, remove, update

    import { Injectable } from '@angular/core'; import {RealtimeService} from "../shared"; imp ...

  5. [AngularFire 2] Joins in Firebase

    Lets see how to query Firebase. First thing, when we do query, 'index' will always help, for both SQ ...

  6. Android多线程研究(9)——读写锁

    一.什么是锁 在Java的util.concurrent.locks包下有关于锁的接口和类如下: 先看一段代码: package com.codeing.snail.test; public clas ...

  7. Java RMI使用

    1. Java RMI介绍 RMI:远程方法调用(Remote Method Invocation).能够让在某个java虚拟机上的对象像调用本地对象方法一样调用另一个java 虚拟机中的对象上的方法 ...

  8. 计算git树上随意两点的近期切割点。

    1.git是一种分布式代码管理工具,git通过树的形式记录文件的更改历史,比方: base'<--base<--A<--A' ^ | --- B<--B' 小米project师 ...

  9. [Angular] How to styling ng-content

    Let's say you are builing a reuseable component. The style structure like this: div > input If yo ...

  10. redis文档翻译_key设置过期时间

    Available since 1.0.0.    使用開始版本号1.01 Time complexity: O(1)  时间复杂度O(1) 出处:http://blog.csdn.net/colum ...