Why is my Azure App Svc refusing to start?

Viewed 269

I have an app svc (a Web API) that I deploy in two flavours: One is "actual" and the other "simulated". The "simulated" version is identical to the "actual" one with the one exception that the API is actually calling a custom HttpMessageHandler when it thinks it's calling its backend (controlled with a compiler flag).

I deploy both of these versions to separate Azure App Services. The "simulated" svc works fine whereas the "actual" one won't start.

I get this in the "actual" (failed) service's event log:

<Events><Event><System><Provider Name="IIS AspNetCore Module V2"/><EventID>1032</EventID><Level>4</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2021-02-10T15:36:13Z"/><EventRecordID>311623453</EventRecordID><Channel>Application</Channel><Computer>***************</Computer><Security/></System><EventData><Data>Application 'D:\home\site\wwwroot\' started successfully.</Data><Data>Process Id: 1048.</Data><Data>File Version: 15.0.20349.2. Description: IIS ASP.NET Core Module V2 Request Handler. Commit: 2670c128d522473e146ff9f8159bfffdfe694cd9</Data></EventData></Event><Event><System><Provider Name="IIS AspNetCore Module V2"/><EventID>1033</EventID><Level>4</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2021-02-10T15:37:40Z"/><EventRecordID>311710406</EventRecordID><Channel>Application</Channel><Computer>***************</Computer><Security/></System><EventData><Data>Application 'MACHINE/WEBROOT/APPHOST/EXTERNALNEWSLETTERS-API-X' has shutdown.</Data><Data>Process Id: 1048.</Data><Data>File Version: 15.0.20349.2. Description: IIS ASP.NET Core Module V2 Request Handler. Commit: 2670c128d522473e146ff9f8159bfffdfe694cd9</Data></EventData></Event><Event><System><Provider Name=".NET Runtime"/><EventID>1026</EventID><Level>1</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2021-02-10T15:37:57Z"/><EventRecordID>311727203</EventRecordID><Channel>Application</Channel><Computer>***************</Computer><Security/></System><EventData><Data>Application: w3wp.exe
CoreCLR Version: 5.0.220.61120
.NET Version: 5.0.2
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.Logging.AzureAppServices, Version=5.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.Extensions.Logging.AzureAppServices, Version=5.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
   at Microsoft.AspNetCore.Hosting.AppServicesWebHostBuilderExtensions.&lt;&gt;c.&lt;UseAzureAppServices&gt;b__0_0(ILoggingBuilder builder)
   at Microsoft.Extensions.DependencyInjection.LoggingServiceCollectionExtensions.AddLogging(IServiceCollection services, Action`1 configure)
   at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.&lt;&gt;c__DisplayClass9_0.&lt;ConfigureLogging&gt;b__0(IServiceCollection collection)
   at Microsoft.AspNetCore.Hosting.HostingStartupWebHostBuilder.&lt;&gt;c__DisplayClass6_0.&lt;ConfigureServices&gt;b__0(WebHostBuilderContext context, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.&lt;.ctor&gt;b__6_2(HostBuilderContext context, IServiceCollection services)
   at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at api.pardot.Program.Main(String[] args) in D:\Source\APIs_to_the_world\api.pardot\api.pardot\Program.cs:line 12
</Data></EventData></Event>

So, unless I'm mistaken, the service failed at loading the Microsoft.Extensions.Logging.AzureAppServices, Version=5.0.3.0 assembly (NuGet)?

In my project this is how Azure logging is being referenced:

      <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
      <PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="5.0.2" />

Two questions:

  1. Is the App Service trying to load the wrong (too high) version? If so, why?
  2. Why would this work in the other app service, based on the exact same project?
0 Answers
Related