ApplicationInsights with a web forms project

0

I have an existing web forms project that I am trying to setup ApplicationInsights logging with Serilog Sinks nuget package, and I have been following these: https://docs.microsoft.com/en-us/azure/azure-monitor/app/asp-net#add-application-insights-manually https://github.com/serilog/serilog-sinks-applicationinsights

The issue i have is that when i try to run the project after adding all the requisite packages from nuget and the rest of the setup code, I get this error:

System.IO.FileLoadException HResult=0x80131040 Message=Could not load file or assembly 'Microsoft.ApplicationInsights, Version=2.12.0.21496, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Source=CXL.UI.Web StackTrace: at CXL.UI.Web.LogConfig.Configure() in D:\HCR\repos\cxl-classic\application\CXL\CXL.UI.Web\App_Start\LogConfig.cs:line 49 at CXL.UI.Web.Ioc.AppPreStart.PreApplicationStart() in D:\HCR\repos\cxl-classic\application\CXL\CXL.UI.Web\App_Start\Ioc\AppPreStart.cs:line 14

I have added a bindingRedirect to the web.config file:

<dependentAssembly>
    <assemblyIdentity name="Microsoft.ApplicationInsights" publicKeyToken="31bf3856ad364e35" 
           culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.16.0.0" newVersion="2.16.0.0" />
</dependentAssembly>

However, the error persists. Any help or ideas would be appreciated.

webforms
azure-application-insights
serilog
asked on Stack Overflow Jan 15, 2021 by Jason Ward

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0