Docker asp.net核心web组件扩展需要设置什么配置?
//Startup.cs 我们添加了openid connect的配置--Azure AD(授权),如果只有一个实例在运行,下面的代码可以正常工作。如果我们扩展为3个实例,那么实例将按预期运行(停靠的容器),但授权没有发生Docker asp.net核心web组件扩展需要设置什么配置?,docker,asp.net-core,single-sign-on,azure-active-directory,openid-connect,Docker,Asp.net Core,Single Sign On,Azure Active Directory,Openid Connect,//Startup.cs 我们添加了openid connect的配置--Azure AD(授权),如果只有一个实例在运行,下面的代码可以正常工作。如果我们扩展为3个实例,那么实例将按预期运行(停靠的容器),但授权没有发生 services.AddAuthentication( options => { options.DefaultSignInScheme = CookieAuthenticatio
services.AddAuthentication(
options =>
{
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultAuthenticateScheme = OpenIdConnectDefaults.AuthenticationScheme;
}).AddCookie(options => new CookieAuthenticationOptions
{
LoginPath = new PathString("/Home/"),
ExpireTimeSpan = TimeSpan.FromMinutes(5),
SlidingExpiration = false,
}).AddOpenIdConnect(options =>
{
options.SignInScheme = "Cookies";
options.ClientId = Configuration["ClientId"];
options.ClientSecret = Configuration["ClientSecret"];
options.Authority = Configuration["AADInstance"] + Configuration["TenantId"];
options.CallbackPath = Configuration["CallbackPath"];
options.ResponseType = OpenIdConnectResponseType.IdToken;
});
我在其中一个实例中得到了以下错误
[40m[1m[33mwarn[39m[22m[49m: Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler[14]
.AspNetCore.Correlation. state property not found.
[40m[1m[33mwarn[39m[22m[49m: Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler[14]
.AspNetCore.Correlation. state property not found.
[41m[30mfail[39m[22m[49m: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]
A unhandled exception has occurred: Correlation failed.
System.Exception: Correlation failed.
at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1. <HandleRequestAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() atSystem.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[40m[1m[33mwarn[39m[22m[49m:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler[14]
找不到.AspNetCore.Correlation.state属性。
[40m[1m[33mwarn[39m[22m[49m:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler[14]
找不到.AspNetCore.Correlation.state属性。
[41m[30mfail[39m[22m[49m:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]
发生未处理的异常:关联失败。
系统异常:关联失败。
在Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.d_u12.MoveNext()中
---在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务)中,从引发异常的上一个位置开始的堆栈结束跟踪-在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()处
解决过这个问题吗?介意分享你的补丁吗?谢谢。解决过这个问题吗?介意分享你的补丁吗?谢谢。