windows-services - 显示Windows服务中的消息框

标签 windows-services messagebox

您可以显示Windows服务中的消息框(或任何形式的通知)吗?无法正常工作。我用了:

            global::System.Windows.Forms.MessageBox.Show("A fatal error occurred. " +
                ServiceName + " is now terminating.");

但是它没有用,只是产生了一个错误。

最佳答案

不可以,您无法显示服务中的消息框。如果您要报告错误,则标准方法是使用event log

对于更多“高级”类型的UI(不仅是错误报告),通常是通过将常规Windows应用程序放入用户的Startup文件夹(或注册表中的Run键)并与该服务对话来完成的通过某种IPC机制(.NET远程处理,WCF,常规套接字,命名管道等)。

关于windows-services - 显示Windows服务中的消息框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2786598/

相关文章:

.net - Windows Service System.Timers.Timer无法启动

oracle - 无法从 Windows 服务连接到 Oracle(错误 : ORA-12154: TNS:could not resolve service name (12154) )

c# - 如何使用带有参数的 CreateProcessAsUser 是日语?

.net - YesNo MessageBox 在单击 x 按钮时未关闭

c# - C#-消息框中同一行上的多个字符串

c# - 如何在消息框中显示列表中的项目?

c# - ASP.NET 的消息框对话框

c++ - 保持 ATL 服务运行的最佳方法是什么

c# - Windows 服务的检测信号事件

c# - MessageBox.Show 问题