Azure Web App在添加Microsoft.Identity.Web引用后无法启动(无法加载文件或程序集“Microsoft.IdentityModel.Logging”)

pxyaymoc  于 2023-10-22  发布在  其他
关注(0)|答案(1)|浏览(106)

将Microsoft.Identity.Web引用添加到ASP.NET Core 7 webapi后,Azure Web应用程序无法启动。(也使用NSwag。)任何想法欢迎!
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); });

异常消息为:

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
42fyovps

42fyovps1#

有点尴尬。我从没提过我的部署计划。Bitbucket Pipeline.依赖项被缓存,如果您更改它们,则需要手动清除该高速缓存。我没有,所以例外。
把这个留在这里,因为它可能会帮助别人。
多谢你的帮助,
詹姆斯

相关问题