从我的应用程序重新启动Windows服务 [英] restarting windows service from my application

查看:66
本文介绍了从我的应用程序重新启动Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我正在使用.Net应用程序(aspx + webservices),它使用我创建的

Windows服务。

有时,链接到我的服务的exe崩溃(主要是运行时

异常),因此我的应用程序无法工作。我不会抓住或控制这些例外情况,所以我的应用程序需要在没有回答任何问题的情况下重启我的服务。

有谁知道怎么做?

我的应用程序是在C#中。我使用VS .NET,我有一个解决方案

包含很多项目,包括我的应用项目和我的windows

服务项目。


欢迎任何帮助!

问候,

G.

Hello,

I am working on a .Net application (aspx+webservices) that uses a
windows service I created too.
Sometimes, the exe linked to my service crashes (mostly runtime
exception), and as a consequence my application can not work. I coult
not catch or controle those exceptions, so my application needs to be
able to restart my service when it does not answer animore.
Does anyone knows how to do that?
My application is in C#. I work with VS .NET, and I have a solution
containing many projects including my application project an my windows
service project.

Any help woulf be welcome!
regards,
G.

推荐答案




" ghighi" < GH *************** @ free.fr>在消息中写道

news:11 ********************** @ j33g2000cwa.googlegr oups.com ...
Hi,

"ghighi" <gh***************@free.fr> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
您好,

我正在开发一个.Net应用程序(aspx + webservices),它使用我创建的
Windows服务。
有时,exe链接到我的服务崩溃(主要是运行时
例外),


我建议你先看看是什么让它崩溃了。


我的应用程序是在C#中。我使用VS .NET,我有一个包含许多项目的解决方案,包括我的应用项目和我的windows
服务项目。
Hello,

I am working on a .Net application (aspx+webservices) that uses a
windows service I created too.
Sometimes, the exe linked to my service crashes (mostly runtime
exception),
I suggest you to see what makes it crash in the first place.

My application is in C#. I work with VS .NET, and I have a solution
containing many projects including my application project an my windows
service project.




见ServiceController类,你可以使用它来控制服务。

你可能需要额外的特权来使用它。


-

-

Ignacio Machin,

ignacio.machin AT dot.state.fl.us

佛罗里达州交通局



See the ServiceController class, you can control a service with it.
You may need extra privilegies for using it though.

--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


2006年5月17日23:59:37 -0700,ghighi < gh *************** @ free.fr>

写道:
On 17 May 2006 23:59:37 -0700, "ghighi" <gh***************@free.fr>
wrote:
你好,
我正在开发一个.Net应用程序(aspx + webservices),它使用我创建的
Windows服务。
有时,链接到我服务的exe崩溃(主要是运行时
例外),因此我的应用程序无法正常工作。我没有抓住或控制这些异常,所以我的应用程序需要能够在不回复任何时候重启我的服务。
有谁知道怎么做?
我的应用程序是在C#中。我使用VS .NET,我有一个包含许多项目的解决方案,包括我的应用程序项目和我的windows
服务项目。

欢迎任何帮助!
问候,
G。
Hello,

I am working on a .Net application (aspx+webservices) that uses a
windows service I created too.
Sometimes, the exe linked to my service crashes (mostly runtime
exception), and as a consequence my application can not work. I coult
not catch or controle those exceptions, so my application needs to be
able to restart my service when it does not answer animore.
Does anyone knows how to do that?
My application is in C#. I work with VS .NET, and I have a solution
containing many projects including my application project an my windows
service project.

Any help woulf be welcome!
regards,
G.



嗨G


您可以使用IADsService接口,它是Active的一部分

目录,看这里
http://msdn.microsoft.com/library/de...adsservice.asp

或者您可以使用WMI Win32_Service方法

http://msdn.microsoft.com/library/de...32_service.asp


希望这会有所帮助
< br $> b $ b cherrs


史蒂夫

http://pretty-vacant.co.uk


Hi G

you could use the IADsService interface which is part of Active
Directory, look here
http://msdn.microsoft.com/library/de...adsservice.asp
or you could use the WMI Win32_Service methods

http://msdn.microsoft.com/library/de...32_service.asp

Hope this helps

cherrs

Steve

http://pretty-vacant.co.uk


您好,

感谢您的帮助。


问题是我的异常是意料之外的,

几乎/不可重现,我无法捕捉或控制它们。


我试图使用servicecontroller类;它似乎很好(我可以获得我的

服务状态)但我无法启动或停止我的服务...

我需要使用什么样的特权它?我在哪里配置它?


thx,

G.

Hello,
thanks for your help.

The problem is that My exceptions are unexpected,
hardly/un-reproducible and I can not catch or control them.

I tried to use servicecontroller class; it seems good (I can get my
service status for example) but I can not start or stop my service...
what kind of privilegies do I need to use it? where do I configure it?

thx,
G.


这篇关于从我的应用程序重新启动Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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