设置c#windows服务描述及允许服务与桌面交互
来源:互联网 发布:马哥linux全套 网盘 编辑:程序博客网 时间:2024/06/05 06:30
- 设置描述内容
在ProjectInstaller.cs重写 install() ,Uninstall()方法
public override void Install(IDictionary stateServer)
{
Microsoft.Win32.RegistryKey system,
//HKEY_LOCAL_MACHINE/Services/CurrentControlSet
currentControlSet,
//.../Services
services,
//.../<Service Name>
service,
//.../Parameters - this is where you can put service-specific configuration
config;try
{
//Let the project installer do its job
base.Install(stateServer);//Open the HKEY_LOCAL_MACHINE/SYSTEM key
system = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("System");
//Open CurrentControlSet
currentControlSet = system.OpenSubKey("CurrentControlSet");
//Go to the services key
services = currentControlSet.OpenSubKey("Services");
//Open the key for your service, and allow writing
service = services.OpenSubKey(this.serviceInstaller1.ServiceName, true);
//Add your service's description as a REG_SZ value named "Description"
service.SetValue("Description","PI实时数据采集:能源--每天8点或20点取一次数据;汽车衡--每天1点取一次数据;设备状态--每分钟取一次数据。");
//(Optional) Add some custom information your service will use...
//允许服务与桌面交互
service.SetValue("Type",0x00000110);
config = service.CreateSubKey("Parameters");
}
catch(Exception e)
{
Console.WriteLine("An exception was thrown during service installation:/n" + e.ToString());
}
}public override void Uninstall(IDictionary stateServer)
{
Microsoft.Win32.RegistryKey system,
currentControlSet,
services,
service;try
{
//Drill down to the service key and open it with write permission
system = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("System");
currentControlSet = system.OpenSubKey("CurrentControlSet");
services = currentControlSet.OpenSubKey("Services");
service = services.OpenSubKey(this.serviceInstaller1.ServiceName, true);
//Delete any keys you created during installation (or that your service created)
service.DeleteSubKeyTree("Parameters");
//...
}
catch(Exception e)
{
Console.WriteLine("Exception encountered while uninstalling service:/n" + e.ToString());
}
finally
{
//Let the project installer do its job
base.Uninstall(stateServer);
}
}
- 设置c#windows服务描述及允许服务与桌面交互
- 设置c#windows服务描述及允许服务与桌面交互的几种方法
- 设置c#windows服务描述及允许服务与桌面交互的几种方法
- Windows服务“允许服务与桌面交互”
- Windows服务安装后设置自动启动与允许服务与桌面交互的方法
- Windows服务安装后设置自动启动与允许服务与桌面交互的方法
- C#设置服务允许与桌面交互,并且启动服务
- C# Windows服务“允许服务与桌面交互”
- C# 编写Windows服务并设置为“允许服务与桌面交互”
- 设置C# Windows 服务与桌面交互
- c# 通过程序来设置允许服务与桌面交互
- 用VS2003部署,让服务程序安装完后立即启动服务并且选中“允许服务与桌面交互”及添加服务描述的方法
- c# 允许服务与桌面交互
- C#允许服务与桌面交互
- Windows服务“允许服务与桌面交互”的使用和修改方法
- C#允许服务与桌面交互实现浅析
- C#中windows 服务与桌面交互
- windows WTS 服务与桌面交互
- 鼠标移到GridView某一行时改变该行的背景色方法一
- 一些常用的命令
- IT支出破3万亿美元 发展中国家增长快
- 计算机体系结构知识点汇集
- My linux Mobile E680 Devp Envirment build up 001
- 设置c#windows服务描述及允许服务与桌面交互
- linux的任务调度命令--crontab
- GridView和CheckBox结合
- C Knowledge
- Hide Port/Link Bypass IceSword 1.22
- AOP
- linux的监控命令总结
- shawl.qiu javascript 日历控件类(Calendar) v1.0
- 温故而知新,学习MFC框架如何创建的过程