简体   繁体   中英

debug program.cs using visual studio remote debugger on IIS

I am trying to remotely debug a project with ASP.NET Core 2.1 that uses IIS as a server using the remote debugger tool, since I was able to establish the connection to the remote server and debug some things using breakpoints, the problem that is currently happening to me is that I can debug the file code as controllers,services, but I cannot debug the Program.cs file code using breakpoints.

Any ideas?

you could check the below things if you are not getting any error but breakpoint didn't hit:

1)if you are running your code on more than one machine so the first check you are debugging the correct place code.

2)make sure your codding is running and you set the System.Diagnostics.Debugger.Break or __debugbreak ( for c++) in your code where you want to set the breakpoint. (do not forget to build your project after adding this code)

3)If you are debugging optimized code, make sure the function where your breakpoint is set isn't being inlined into another function. The Debugger.Break test described in the previous check can work to test this issue as well.

Add a call to Launch at the beginning of the OnStart()method.

protected override void OnStart(string[] args)
{
    System.Diagnostics.Debugger.Launch();
}

How to: Debug the OnStart Method

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM