Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way for a .Net Windows service to report an error to the user

I am writing a windows service that will be doing a lot of network communication, and I need a way to notify a user (if logged on) of any exceptions/errors. I know it is bad practice to allow a service to interact with the desktop, so is there an alternative way to notify a user that an error has occurred? I am aware of event logging, but I would also like to be able to show a notification bubble from the system tray or something that catches the user's attention.

like image 974
Phil Avatar asked Dec 11 '09 16:12

Phil


People also ask

How do I get the services window to report an error?

If the main thing you want is for the Services window to report that there was an error, from what I've tried (.NET3.5 on Windows 7), the only way to do this is by setting the ExitCode. I recommend setting it to 13816, since this results in the message, "An unknown error has occurred." See the windows error codes.

What is Microsoft error reporting and how does it work?

Microsoft can use the error reporting feature to provide customers with troubleshooting information, solutions, or updates for their specific problems. Developers can use this infrastructure to receive information that can be used to improve their applications. Users can enable error reporting through the Windows user interface.

How do I monitor the performance of Windows services?

Monitoring Windows Services is critical to making sure that they are working correctly and performing well. Retrace is an excellent solution for monitoring the performance of your Windows Services. Retrace works with all ASP.NET, .NET Core, and .NET applications. Retrace also works for Azure WebJobs and Azure Functions.

How do I know if a service is running on Windows?

In Windows, open the Services desktop app. Press Windows+R to open the Run box, enter services.msc, and then press Enter or select OK. You should see your service listed in Services , displayed alphabetically by the display name that you set for it.


1 Answers

Please consider using Event Log and a separate application just for monitoring. You can also consider using emails or MSMQ.

like image 184
Piotr Justyna Avatar answered Oct 01 '22 08:10

Piotr Justyna