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

 
       


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM