0

I learned that for Windows Service Debugging in Visual Studio 2015 IDE, launch the service from IDE using the ā€œ-cā€ command-line switch. This enables the service to run as a console application.

Why do we need to enable the service to run as a console application, in order to debug the service?

Does running as a console application here mean running as a foreground process?

Does running a service here mean running as a background daemon?

How do we debug a service, if running it normally instead of running as a console application?

Is the switch "-c" a switch of Visual Studio debugger, or of something else?

Thanks

Tim
  • 1
  • 122
  • 314
  • 481

1 Answers1

1

This blog also shared us the reason why we convert a Service to Console Application for Debugging like "debug more easier" or others:

https://social.technet.microsoft.com/wiki/contents/articles/30957.c-windows-service-in-console-mode-for-debug-and-admin.aspx.

I think the command line switch would be similar to the UT project property settings.

To debug the windows Server without using the console app type, you could use the attach to process or customer code or unit tests:

https://msdn.microsoft.com/en-us/library/7a50syb3(v=vs.110).aspx

Easier way to debug a Windows service

Community
  • 1
  • 1
Jack Zhai-MSFT
  • 5,646
  • 1
  • 9
  • 19