0

When I run our Web Api (.NET Framework 4.6.2project on IISExpress with the Visual Studio debugger on, some of our endpoints are really slow: 16 seconds instead of 200ms, or as in the example 8 seconds instead of 3 seconds.

enter image description here

When I stop the debugger of Visual Studio and the application is still running on IISExpress in the background, the API is very fast again.

I guess it could will be a setting in Visual Studio, but I can't find it. I have searched and tried some settings which I found on StackOverflow for example: - 'Just my code', which is on - Symbols are cached in a folder and Microsoft Symbol Servers is off - Browser link is off

Appsum Solutions
  • 999
  • 2
  • 10
  • 30

2 Answers2

2

Thanks for the help, but I've solved it using following Stackoverflow response: Why is DbContext.SaveChanges 10x slower in debug mode As he states: Ok, so the reason debug mode was exceptionally slow was because Visual Studio's Intellitrace was recording each ADO.NET event ( all 20, 000 of them ) generated by Entity Framework.

So Tools-> Options -> IntelliTrace and Uncheck "Enable IntelliTrace" fixed the issue.

Or one can also just filter out the ADO.NET events by going to Tools->Options -> IntelliTrace -> IntelliTrace Events and uncheck ADO.NET

Appsum Solutions
  • 999
  • 2
  • 10
  • 30
0

Some Web Api endpoints very slow when Visual Studio debugger is on

Besides, l think you can try these steps:

1) uncheck the option Enable Diagnostic Tools while debugging in Tools-> Options ->Debugging->General

2) please make sure that you have disable Enable JavaScript debugging for ASP.NET in Tools->Options->Debugging ->General

In addition, if you are using VS 2019 Enterprise edition, try disable IntelliTrace feature (Tools -> Options -> IntelliTrace)

More info you could refer to this link.

Mr Qian
  • 21,064
  • 1
  • 31
  • 41