Use the following code in service OnStart
method:
System.Diagnostics.Debugger.Launch();
Choose the Visual Studio option from the pop up message.
Note: To use it in only Debug mode, a #if DEBUG
compiler directive can be used, as follows. This will prevent accidental or debugging in release mode on a production server.
#if DEBUG
System.Diagnostics.Debugger.Launch();
#endif
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…