Using Debug View with a Windows Service

2019-06-17 07:06发布

I'm having trouble with real time debugging of a Windows service on a remote machine. This machine is behind a firewall only accessible through remote desktop. I include Debug.WriteLine statements through my code, in lieu of Console.WriteLine. Not too long ago I ran across an application from Microsoft named Debug View. It has been helpful in debugging Forms and WPF applications but it will not show the Debug.WriteLine statements for a running service. I would be extremely happy if I could see these debug statements. Is there a way to do this?

Note, the project is compiled in debug mode as I can see the debug statements in Debug View during the service installation.

1条回答
ら.Afraid
2楼-- · 2019-06-17 08:04

Run Debug View as Administrator, select the Capture menu, then make sure that Capture Global Win32 is checked. That will capture Debug.WriteLine output from your service (and any other service as well). You may want to use a filter to prevent Debug View from displaying output you are not interested in. Consider prefixing your service debug messages with your service name so that you can filter for them.

查看更多
登录 后发表回答