Show a message box from a Windows Service

前端 未结 6 868
-上瘾入骨i
-上瘾入骨i 2020-12-06 00:48

Can you display a message box (or any form of notification) from a windows service? Can\'t get it to work. I used:

            global::System.Windows.Forms.M         


        
6条回答
  •  旧巷少年郎
    2020-12-06 01:07

    No, you cannot show a message box from a service. If you want to report errors, the standard way to do this is with the event log.

    For more "advanced" kinds of UI (not just error reporting), the way this is typically done is via a regular windows application that you put in the user's Startup folder (or the Run key in the registry) and that talks to the service via some kind of IPC mechanism (.NET remoting, WCF, regular sockets, named pipes, etc).

提交回复
热议问题