Application.Run()在Windows服务中 [英] Application.Run() In a Windows Service

查看:104
本文介绍了Application.Run()在Windows服务中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多线程的Windows窗体应用程序,在调用Application.Run()之后运行很好。 COM组件需要Application.Run

我在应用程序中使用(消息循环需要)。我从VStudio 2005模板创建了一个windows

服务。什么是Windows服务更换

for Application.Run()?

I have a multi threaded windows form application that runs great after
calling Application.Run(). Application.Run is required for a COM component
I a using in the app (required for message loop). I have created a windows
service from VStudio 2005 template. What is the windows service replacement
for Application.Run()?

推荐答案



< msnews.microsoft.com写信息

新闻:Oc ************* @ TK2MSFTNGP06.phx.gbl ...

<msnews.microsoft.comwrote in message
news:Oc*************@TK2MSFTNGP06.phx.gbl...

>我有一个多线程的Windows窗体应用程序,在调用Application.Run()之后运行得很好。 COM组件需要Application.Run
我在应用程序中使用(消息循环需要)。我已经从VStudio 2005模板创建了一个windows
服务。什么是Windows服务
替换Application.Run()?
>I have a multi threaded windows form application that runs great after
calling Application.Run(). Application.Run is required for a COM component
I a using in the app (required for message loop). I have created a windows
service from VStudio 2005 template. What is the windows service
replacement for Application.Run()?



ServiceBase.Run(new service_class);也许,

但你必须用OnStart编写类(service_class)(这里你必须

调用你的主代码),OnPause,OnStop方法继承

System.ServiceProcess.ServiceBase

D

ServiceBase.Run(new service_class); maybe,
but you have to write class (service_class) with OnStart (here you must
call your main code) , OnPause, OnStop methods that inherites
System.ServiceProcess.ServiceBase

D


非常感谢。不过我试过没试过。出于某种原因,这个com

组件只有在没有application.run的情况下才能运行...它不会在

赢得服务中工作。

" Dubravko Sever < Du ****************** @ foi.hrwrote in message

news:f2 ********** @ news1 .carnet.hr ...
Thanks a lot. I have tried, however, no luck. For some reason this com
component just wont function without application.run... which wont work in
the win service.
"Dubravko Sever" <Du******************@foi.hrwrote in message
news:f2**********@news1.carnet.hr...

>

< msnews.microsoft.comwrote in message

新闻:Oc ************* @ TK2MSFTNGP06.phx.gbl ...
>
<msnews.microsoft.comwrote in message
news:Oc*************@TK2MSFTNGP06.phx.gbl...

>>我有一个多线程在调用Application.Run()之后,windows表单应用程序运行良好。在应用程序中使用的COM
组件需要Application.Run(消息循环需要)。我已经从VStudio 2005模板创建了一个Windows服务。什么是Application.Run()的窗口
服务替换?
>>I have a multi threaded windows form application that runs great after
calling Application.Run(). Application.Run is required for a COM
component I a using in the app (required for message loop). I have
created a windows service from VStudio 2005 template. What is the windows
service replacement for Application.Run()?



ServiceBase.Run(new service_class);也许,

但你必须用OnStart编写类(service_class)(这里你必须

调用你的主代码),OnPause,OnStop方法继承

System.ServiceProcess.ServiceBase


D

ServiceBase.Run(new service_class); maybe,
but you have to write class (service_class) with OnStart (here you must
call your main code) , OnPause, OnStop methods that inherites
System.ServiceProcess.ServiceBase

D



你有没有检查您的帐户是否有足够的权限?尝试以管理员身份运行您的

服务以进行测试。


D


< msnews.microsoft .comwrote in message

news:eV ************** @ TK2MSFTNGP06.phx.gbl ...
Have you check your account does it have enough permissions? Try to run your
service as a administrator just for testing.

D

<msnews.microsoft.comwrote in message
news:eV**************@TK2MSFTNGP06.phx.gbl...

非常感谢。不过我试过没试过。出于某种原因,这个com

组件在没有application.run的情况下才能运行...它不会在

赢得服务中工作。


" Dubravko Sever" < Du ****************** @ foi.hrwrote in message

news:f2 ********** @ news1 .carnet.hr ...
Thanks a lot. I have tried, however, no luck. For some reason this com
component just wont function without application.run... which wont work in
the win service.
"Dubravko Sever" <Du******************@foi.hrwrote in message
news:f2**********@news1.carnet.hr...

>>
< msnews.microsoft.com写信息
新闻:Oc *** ********** @ TK2MSFTNGP06.phx.gbl ...
>>
<msnews.microsoft.comwrote in message
news:Oc*************@TK2MSFTNGP06.phx.gbl...

>>>我有一个多线程的Windows窗体应用程序,在调用Application.Run()之后运行得很好。在应用程序中使用的COM
组件需要Application.Run(消息循环需要)。我已经从VStudio 2005模板创建了一个Windows服务。什么是Application.Run()的
Windows服务替换?
>>>I have a multi threaded windows form application that runs great after
calling Application.Run(). Application.Run is required for a COM
component I a using in the app (required for message loop). I have
created a windows service from VStudio 2005 template. What is the
windows service replacement for Application.Run()?


ServiceBase.Run(new service_class);也许,
但你必须用OnStart编写类(service_class)(这里你必须调用你的主代码),OnPause,OnStop方法继承
System.ServiceProcess.ServiceBase



ServiceBase.Run(new service_class); maybe,
but you have to write class (service_class) with OnStart (here you must
call your main code) , OnPause, OnStop methods that inherites
System.ServiceProcess.ServiceBase

D




这篇关于Application.Run()在Windows服务中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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