net core 3 报An unhandled exception occurred while processing the request错误

使用net core 开发时报以下错误

An unhandled exception occurred while processing the request.

Exception: Correlation failed.

Unknown location

Exception: An error was encountered while handling the remote login.

Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler<TOptions>.HandleRequestAsync()

看了一下后台错误原因,貌似是cookies没有存储上,然后就想到了net core 3 生成的项目模板默认实现了<<通用数据保护条例>>,所以设置存储Cookie需要做一些处理。

1.第一种是在Startup的ConfigureServices方法中关闭这个支持.(我使用的此方法解决了以上问题)

services.Configure<CookiePolicyOptions>(option => {
                option.CheckConsentNeeded = context => false;
            });

2.设置存储的Cookie为重要(未实际试验)

 this.Response.Cookies.Append("stdio", DateTime.Now.ToString(), new CookieOptions {
                IsEssential = true
            });

 参考文章:https://www.cnblogs.com/zzr-stdio/p/10617532.html


posted @ 2020-06-30 09:56  马克部落格  阅读(3394)  评论(0编辑  收藏  举报