由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
DotNet版 - How to stop windows service in OnStart()
相关主题
VS2010 Add reference Dialog, not goodhow to download a https file
请各位老大分享一下exception的使用经验吧。[合集] 问一个Response.WriteFile的问题
[转载] 问一个javascript 和 .NET 的问题一个问题
preparing to install ...anyone tried vs2010 beta2?
which one is the WizardBar?问个webbrowser控件的问题
How to kill popup in Outlook add-ins?请指点
ASP.NET -- helpJquery dialog问题请教
[转载] 如何知道CLIENT一端屏幕的大小?Help!
相关话题的讨论汇总
话题: onstart话题: service话题: stop话题: windows话题: license
进入DotNet版参与讨论
1 (共1页)
f*****e
发帖数: 5177
1
I have a windows service which checks license in OnStart(). If the license
is not there, it should stop. I have tried several different ways to do that
, such as throw an exception. It works. The only problem is that it pops up
a dialog saying "service on local computer started then stopped. xxxxx" and
user need to click OK to discharge the message dialogue. Is there a way to
stop the service w/o any front end popup?
o****e
发帖数: 916
2
what's in your servicebase.OnStart? suppose you kick of a new thread in that
method or do indefinite wait in that loop. if you do the license check in
that main thread and exit the main thread if the license is invalid, would
the service be stopped? anyway, you can always handle any unhandled
exception in Appdomain.CurrentDomain.UnhandledException (except for some
exception originated from unmanaged stack)
not familiar with service programming, just my guess
f*****e
发帖数: 5177
3
Solved. The problem is that I start the service by calling OnStart() and
then stop it because license check failed. Windows thinks the service
started and then immediately stopped is a application failure and popup the
message box. The solution is to start a work thread, wait for 10 seconds
then call Stop().

that

【在 o****e 的大作中提到】
: what's in your servicebase.OnStart? suppose you kick of a new thread in that
: method or do indefinite wait in that loop. if you do the license check in
: that main thread and exit the main thread if the license is invalid, would
: the service be stopped? anyway, you can always handle any unhandled
: exception in Appdomain.CurrentDomain.UnhandledException (except for some
: exception originated from unmanaged stack)
: not familiar with service programming, just my guess

1 (共1页)
进入DotNet版参与讨论
相关主题
Help!which one is the WizardBar?
求建议:用什么软件开发好?How to kill popup in Outlook add-ins?
VS里有没有overview ruler的功能ASP.NET -- help
Who can tell me why i cannot connect to the SQL db file ?[转载] 如何知道CLIENT一端屏幕的大小?
VS2010 Add reference Dialog, not goodhow to download a https file
请各位老大分享一下exception的使用经验吧。[合集] 问一个Response.WriteFile的问题
[转载] 问一个javascript 和 .NET 的问题一个问题
preparing to install ...anyone tried vs2010 beta2?
相关话题的讨论汇总
话题: onstart话题: service话题: stop话题: windows话题: license