Azure Web App failing to start after adding Microsoft.Identity.Web reference to a ASP.NET Core 7 webapi. (Also using NSwag.) Any ideas welcome!

Program.cs:

using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Identity.Web;

services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
        .AddMicrosoftIdentityWebApi(options =>
        {
            builder.Configuration.Bind("AzureAdB2C", options);

            options.TokenValidationParameters.NameClaimType = "emails";
        },
   options => { builder.Configuration.Bind("AzureAdB2C", options); });

Exception message is:

2023-10-12T16:07:25.283502021Z Documentation: http://aka.ms/webapp-linux
2023-10-12T16:07:25.283505121Z Dotnet quickstart: https://aka.ms/dotnet-qs
2023-10-12T16:07:25.283508021Z ASP .NETCore Version: 7.0.12
2023-10-12T16:07:25.283511021Z Note: Any data outside '/home' is not persisted
2023-10-12T16:07:26.566706113Z Starting OpenBSD Secure Shell server: sshd.
2023-10-12T16:07:27.025878864Z Starting periodic command scheduler: cron.
2023-10-12T16:07:27.036415801Z Running oryx create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -defaultAppFilePath /defaulthome/hostingstart/hostingstart.dll     -bindPort 8080 -bindPort2 '' -userStartupCommand 'dotnet Pyxis.dll' 
2023-10-12T16:07:27.513081949Z Could not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2023-10-12T16:07:27.513133748Z Could not find operation ID in manifest. Generating an operation id...
2023-10-12T16:07:27.520703403Z Build Operation ID: 66a6a46e-827a-437d-a4a1-9573ed15fdc6
2023-10-12T16:07:28.246319362Z 
2023-10-12T16:07:28.246362562Z Agent extension disabled
2023-10-12T16:07:28.263715058Z Before if loop >> DotNet Runtime 
2023-10-12T16:07:28.366757042Z DotNet Runtime 7.0Writing output script to '/opt/startup/startup.sh'
2023-10-12T16:07:28.582742850Z Running user provided startup command...
2023-10-12T16:07:41.814918942Z Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Logging, Version=6.33.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
2023-10-12T16:07:41.814977242Z 
2023-10-12T16:07:41.814985742Z File name: 'Microsoft.IdentityModel.Logging, Version=6.33.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
2023-10-12T16:07:41.814990342Z    at Microsoft.Identity.Web.MicrosoftIdentityBaseAuthenticationBuilder..ctor(IServiceCollection services, IConfigurationSection configurationSection)
2023-10-12T16:07:41.814994942Z    at Microsoft.Identity.Web.MicrosoftIdentityWebApiAuthenticationBuilder..ctor(IServiceCollection services, String jwtBearerAuthenticationScheme, Action`1 configureJwtBearerOptions, Action`1 configureMicrosoftIdentityOptions, IConfigurationSection configurationSection)
2023-10-12T16:07:41.814999542Z    at Microsoft.Identity.Web.MicrosoftIdentityWebApiAuthenticationBuilderExtensions.AddMicrosoftIdentityWebApi(AuthenticationBuilder builder, Action`1 configureJwtBearerOptions, Action`1 configureMicrosoftIdentityOptions, String jwtBearerScheme, Boolean subscribeToJwtBearerMiddlewareDiagnosticsEvents)
2023-10-12T16:07:41.822980694Z    at Program.<Main>$(String[] args) in /opt/atlassian/pipelines/agent/build/Pyxis2/Program.cs:line 26
2023-10-12T16:07:47.185548054Z /opt/startup/startup.sh: line 18:    74 Aborted                 (core dumped) dotnet Pyxis.dll
1

There are 1 answers

0
JamesB On

Bit embarrassing this. I never mentioned my deployment pipeline. Bitbucket Pipeline. The dependencies are cached and if you change them you need to manually clear the cache. I didn't, hence the exception.

Leaving this here as it might help someone else.

Thanks for you help,

James