文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > 用C#创建Windows服务(Windows Services)
侵权投诉

用C#创建Windows服务(Windows Services)

用C#创建Windows服务(Windows Services)

3:若要确定如何启动服务,请单击 ServiceInstaller 组件并将 StartType 属性设置为适当的 Manual 服务安装后,必须手动启动。

Automatic 每次计算机重新启动时,服务都会自动启动。

Disabled 服务无法启动。

4:将serviceProcessInstaller类的Account属性改为 LocalSystem

这样,不论是以哪个用户登录的系统,服务总会启动。

第四步:生成服务程序

通过从生成菜单中选择生成来生成项目。

注意 不要通过按 F5 键来运行项目——不能以这种方式运行服务项目。

第五步:安装服务

访问项目中的已编译可执行文件所在的目录。

用项目的输出作为参数,从命令行运行 InstallUtil.exe。在命令行中输入下列代码: installutil yourproject.exe

注:InstallUtil.exe有两个版,在我机器上的位置是:

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\InstallUtil.exe 16K 用于.net1C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe 26K 用于.net2

卸载服务

用项目的输出作为参数,从命令行运行 InstallUtil.exe。

installutil /u yourproject.exe

如果文件换了个文件夹,再运行可能会出错,您可以在CMD里输入:SC delete 服务名,删除服务

或者

建成reg.bat文件,内容如下

注册服务

%windir%\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe %CD%\SendEmail.net start SendEmail

卸载服务:

上一页第3页

你可能喜欢

热门文档

相关文档

  • 用Visual C#创建Windows服务程序

    () };System.ServiceProcess.ServiceBase.Run(MyServices);} static void Main() 三.添加文件监视服务: 添加文件监视服务: 了解了 Windows 服务的基本体系结构和...

  • 用c#创建windows服务

    ? 在类后面所包含的代码里,你会注意到你所创 建的Windows服务扩充了 System.ServiceProcess.Service类。所有以.NET 方式建立的Windows服务必须扩充这个类。它会要 ...

  • 用C#创建Windows Service

    用C#创建 Windows Service 现在的。NET 框架已经为 Windows service 的开发提供足够强大的支持,你只需要关注 service 所要实现的逻辑,而完全不用关心 service 底层...

  • C#创建windows服务

    C#创建windows服务_建筑/土木_工程科技_专业资料。C#创建windows服务C#创建 windows 服务 发布人:admin 发布日期: 2008-01-18 阅读: 121 Windows 服务是独立于...

  • 用C#创建Windows Service (2)

    C:\>cd C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>installutil D:\WindowsServicePort\ ...

  • C# 创建Windows服务。服务功能:定时操作数据库

    WindowsService1.exe" 四、查看 window 服务 services.msc 控制面板-->管理工具-->服务,可在此手动启动,停止服务 五、调试 window 服务 1、通过【事件查看器】...

  • c#开发和部署windows服务

    (), new Service2() }; System.ServiceProcess.ServiceBase.Run(MyServices);...Windows 服务 (Windows Service)选项,给工程一个新文件名 WindowsService,然后点...

  • C# VS 2010 创建、安装、调试 windows服务(windows ser...

    C# VS 2010 创建、安装、调试 windows服务(windows service)_电脑基础知识_IT/计算机_专业资料。C# VS 2010 创建、安装、调试 windows服务(windows service)...

  • C#创建windows服务组件

    第一步:创建服务框架 要创建一个新的 Windows 服务,可以从 Visual C# 工程中选取 Windows 服务(Windows S ervice)选项,给工程一个新文件名,然后点击确定。 你...

  • C#创建Windows服务

    用C#创建Windows服务(Windows Services) Windows服务在Visual Studio 以前的版本中叫NT服务,在VS.net启用了新的名称。用Visual C# 创建Windows服务不是一件困难的...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email