如何在asp.net代码中安装和运行Windows服务? [英] How to install and run a windows service in asp.net code behind?

查看:112
本文介绍了如何在asp.net代码中安装和运行Windows服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在asp.net中安装和运行Windows服务?



我运行已安装的服务为

ServiceController service = new ServiceController(C3PSPS_Service);



TimeSpan超时= TimeSpan.FromMilliseconds(timeoutMilliseconds);



service.Start();

service.WaitForStatus (ServiceControllerStatus.Running,超时);

并且它有效。



现在我想在asp.net代码中安装它并运行同样。

How to install and run a windows service in asp.net ?

I ran the installed service as
ServiceController service = new ServiceController("C3PSPS_Service");

TimeSpan timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds);

service.Start();
service.WaitForStatus(ServiceControllerStatus.Running, timeout);
and it worked.

Now i want to install it in asp.net code behind and run the same.

推荐答案

参考



http://www.thedavejay.com/2012/04/self-installing-c-windows-service-safe.html [ ^ ]



http://stackoverflow.com/questions/4144019/self-install-windows-service-in-net-c-sharp [ ^ ]



http://stackoverflow.com/questions/358700/how-to-install-a-windows-service-programmatically-in-c [ ^ ]



希望这有助于
Refer

http://www.thedavejay.com/2012/04/self-installing-c-windows-service-safe.html[^]

http://stackoverflow.com/questions/4144019/self-install-windows-service-in-net-c-sharp[^]

http://stackoverflow.com/questions/358700/how-to-install-a-windows-service-programmatically-in-c[^]

Hope this helps


这篇关于如何在asp.net代码中安装和运行Windows服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆