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 |
|
p**r 发帖数: 488 | 4 推荐我的大宝子 -- Chev Malibu
买了两个月多,目前很满意。质量,尤其是动力系统应该是有保障的。 这套混动系统
是从Volt移植来的,应该算比较成熟可靠。
优点:
省油。 目前共开了近6000麦,显示44MPG, 自己根据加油量算的大于45MPG (唯一
一款开过的车载显示油耗不如实际的)。我开车比较猛,高速常限速+10。 一次走
local,车多不能提速,全程在50MPH, 居然显示 50+ MPG。 天冷时明显油耗高,等天
暖和了, 应该油耗更低。 附图是 Onstart截屏
驾驶感好,提速不错,噪音小,低速纯电模式几乎没有声音。
座椅舒服 ( 这个因人而异)
安全性好
外观大气漂亮
缺点
后备箱小, 被电池占了不少空间,比普通Malibu 小不少。
|
|