f*e
2 楼
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?
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
3 楼
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
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
4 楼
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
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
相关阅读
大家觉得 CLR via C# 这本书怎么样?有人试过.Net 3.0吗?Log on to a remote computerPermission issue of System.Diagnostics.ProcessCurious for VBSCRIPT in ASP file[合集] webbrowser control questionInteresting change in vs 2005What is SmartClient?How to quick update a Access Report?DotNet 版空文章已被系统自动清除C#.Net Funsdamentals (5)Assembly Security Discussion看看这个How to hide address bar, menu bar, tool bar, tabs from IE?IE developer toolbar大侠们帮帮忙---网络连接问题, 在线等!为什么web server自动改我的form action刚去java版转了一圈about ArrayList麻烦推荐一本VB.NET书?