Profiling an ASP.NET Core application on IIS
Published 20 November 2020
By default, your application will be profiled on an unused port.
If you don't want to profile on a different port, for example because you've hard-coded a specific port into your web application, IIS will restart when profiling begins.
Profiling ASP.NET Core applications is available only on IIS 7 and later.
To profile ASP.NET applications running on IIS:
- Start ANTS Memory Profiler and click
- From the list of application types, select IIS - ASP.NET Core.
- Next to URL for ASP.NET Core web application, click
- Select the application that you want to profile from the drop-down list of applications currently running on IIS:
- If you want to choose an unused port to profile on, or change the user account your application will run under, click Show server options.
- If you don't want IIS to restart, select Unused port (this is the default option).
- If you've hard-coded a port into your application, select Original port (IIS will restart).
- If you select Manually specify ASP account details, the account must have administrator privileges, and permission to read from %ProgramFiles%\Red Gate\ANTS Memory Profiler 11\RedGate.Memory.Core.dll
If you don't specify an account, your web application will run under the Windows Local System account.
- If you want to record extra performance counters, click Edit counters and select the counters you want.
Move your mouse pointer over a performance counter to read more about it.
For more information about performance counters, see Setting up performance counters. - Under Additional profiler options:
- Select Profile child processes to include any processes created by your application in profiling.
If your application has lots of child processes, this option will slow down your application. - Select Track disposal of IDisposable objects to keep track of when IDisposable objects in your application are disposed.
This option will slow down your application slightly. Select Profile unmanaged memory allocations if your application access unmanaged memory through P/Invoke or COM+, and you want to profile the unmanaged memory that your application uses.
This option will slow down your application by up to fifty percent, because a lot of additional information is being tracked.
- Select Make snapshots faster by leaving out object values if you've had problems with snapshots being too slow or too large.
You won't be able to see the values of individual instances, but references between objects aren't affected.
If you want to see the values of strings or the contents of arrays specifically, click Customize and deselect the relevant option.
- Select Profile child processes to include any processes created by your application in profiling.
- Click
The main profiling window is displayed, and your application opens in the browser you selected.
On the timeline, you can see the memory being used by your program, along with any other performance counters you selected. - When your application is in a stable state (ie is fully started up and ready for normal use), click
A memory snapshot gives you a detailed breakdown of the memory being used at that point in time, so that you can compare it with later snapshots. - When you've taken at least two snapshots, you can start to investigate your application's memory usage. See Strategies for memory profiling.