How to profile an ASP.NET Core process with instrumentation?

I would like to get ANTS Profiler 10.1 working with an ASP.NET Core program that we're developing, but it seems like the profiler always launches the assembly unjoined to IIS (i.e. when I use a browser to do something that I would like to profile, IIS launches a new process with the assembly in it instead of sending requests to the instance that ANTS launched.) Any hints on how to get this working? I know I can attach to a running process, but that limits analysis to sampling, and that hasn't provided the information needed to optimize the process's performance.

So far I've tried making sure that the launching environment is the same as what is launched by IIS and/or the Visual Studio debugger, disabling unnecessary profiling options (just had enable inlining and include source code with saved results), and limiting the profiling mode to just methods with source instead of everything. The environment variables I've added include:
ASPNETCORE_ENVIRONMENT, ASPNETCODE_APPL_PATH, ASPNETCORE_CONTENTROOT, ASPNETCORE_HOSTINGSTARTUPASSEMBLIES, ASPNETCORE_IIS_HTTPAUTH, ASPNETCORE_IIS_PHYSICALPATH, ASPNETCORE_IIS_WEBSOCKETS_SUPPORTED
I tried adding ASPNETCORE_URLS, but that resulted in an exception in dotnet.exe, so didn't keep that one.
Tagged:

Best Answer

  • Jessica RJessica R Posts: 998 Rose Gold 2
    Accepted Answer

    Hi @CEC,

    I've confirmed that this unfortunately isn't possible at the moment, as ANTS does not support IIS & IIS Express for .NET Core. :/

    However, I've logged a feature request with internal reference PP-4140. Thank you for your feedback and sorry again that it's not possible at the moment!

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


Answers

  • Hi @CEC,

    As far as I'm aware, there's unfortunately no way to connect to an already running process aside from attaching to it. If not attaching, the profiler needs to start the process on its own in order to hook itself into the process (which is what allows for instrumentation).

    I'm quite certain this is the case, but I'm going to do some testing to be sure if there's any sort of exception for ASP.NET Core. I'll post here once I confirm!

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


  • CECCEC Posts: 2 New member
    Hi Jessica,

    If it helps any, when I debug the process through Visual Studio then stop debugging, the IIS and dotnet processes associated with it stops. If ANTS could then launch the process in such a way that registers itself with IIS, I think instrumented profiling could continue from there. Is there a way to do that?
Sign In or Register to comment.