Web API references Microsoft.ApplicationInsights.AspNetCore that depends on a deprecated package

Angela Calborean 71 Reputation points
2023-05-30T11:39:01.0233333+00:00

Hello,

I have a Web API targeting .NET7. I need to send the logs to Azure and in order to configure this I need a reference to this package: Microsoft.ApplicationInsights.AspNetCore that depends on the deprecated projects.

https://www.nuget.org/packages/Microsoft.AspNetCore.Http/

Is there a workaround to be able to connect to Application Insights but avoid this reference?

Regards,

Angela

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,792 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,148 questions
{count} votes

Accepted answer
  1. AnuragSingh-MSFT 19,686 Reputation points
    2023-05-31T06:15:07.7866667+00:00

    @Angela Calborean , Thank you for posting this question.

    I understand that you are trying to follow the steps mentioned in the following article to configure Application Insights for your ASP.NET Core web API project- Application Insights for ASP.NET Core applications

    I see that the package mentioned in this article, Microsoft.ApplicationInsights.AspNetCore, depends on Microsoft.AspNetCore.Http which is deprecated.

    I am reaching out to our AppInsights team for clarification regarding it and will update this thread soon.


    Regarding your question, if you are only interested in capturing custom logs (for example using ILogger.LogInformation/warning etc.), you can follow the steps mentioned here - Application Insights logging with .NET. Note that it will only enable logging and no other telemetry (request, dependency, exceptions etc.).

    Another option would use Open Telemetry based instrumentation which is in preview, which has its own set of opentelemetry based packages and supports most of the scenarios covered in default package. For more details, see Enable Azure Monitor OpenTelemetry for .NET applications

    Hope this helps. I will update this thread regarding the package mentioned in question which depends on a deprecated package.


0 additional answers

Sort by: Most helpful