dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.22k stars 9.95k forks source link

ASP.NET Core Logging Integration version 7.0.7 on Azure but running on .NET 6 #48898

Open dehaaneric opened 1 year ago

dehaaneric commented 1 year ago

Is there an existing issue for this?

Describe the bug

I run a .NET6 Web API on an Azure App Service. Configured as .NET 6 (LTS).

Through the Azure App Service Console I get:

dotnet --version
7.0.203

I'm running into an error message in the Eventlog.xml of my Azure App Service telling:

<EventData>
<Data>Application: w3wp.exe CoreCLR Version: 6.0.1623.17311 .NET Version: 6.0.16 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=6.0.16.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. File name: 'Microsoft.Extensions.Logging.AzureAppServices, Version=6.0.16.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' at Microsoft.AspNetCore.Hosting.AppServicesWebHostBuilderExtensions.<>c.<UseAzureAppServices>b__0_0(ILoggingBuilder builder) at Microsoft.Extensions.DependencyInjection.LoggingServiceCollectionExtensions.AddLogging(IServiceCollection services, Action`1 configure) at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.<>c__DisplayClass8_0.<ConfigureLogging>b__0(IServiceCollection collection) at Microsoft.AspNetCore.Hosting.HostingStartupWebHostBuilder.<>c__DisplayClass6_0.<ConfigureServices>b__0(WebHostBuilderContext context, IServiceCollection services) at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<.ctor>b__6_2(HostBuilderContext context, IServiceCollection services) at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider() at Microsoft.Extensions.Hosting.HostBuilder.Build()
<....>
</Data>
</EventData>

I got this package in my .NET 6 Web API csproj declared:

<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="6.0.9" />

Expected Behavior

I'm wondering why the process is requesting version 6.0.16.0 from the AzureAppServices package while I'm explicitly having 6.0.9 declared and published.

Is this because the App Service has a Site Extension "ASP.NET Core Logging Integration version 7.0.7"?

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

Application: .NET 6 - App Service: .NET 7

Anything else?

No response

amcasey commented 1 year ago

This seems similar to https://github.com/dotnet/aspnetcore/issues/45673. How would you feel about tracking it over there, @dehaaneric?