我使用AzureAD门户中的快速入门指南,使用ASP.NET CORE创建了一个Web应用程序。登录有效,但是当我尝试注销时,大约5秒钟后,我收到以下消息:
https://i.imgur.com/RhOGaf6.png
我的应用已使用以下重定向URI注册:
https://i.imgur.com/CAnQpM8.png
使用https://localhost:52410/signout-oidc作为注销URL,并启用ID令牌的隐式大写。
我可以在网络下的浏览器调试菜单中看到没有响应 从注销URL。因此,我假设弹出错误消息是因为注销URL需要很长时间才能响应。
注意:如果重新加载浏览器页面时出现错误,我执行注销。
所以我想知道如何解决此错误消息?
答案 0 :(得分:1)
我通过调整launchSettings.json文件解决了此错误。
我将iisSettings中的iisExpress设置调整为使用SSL,如下所示:
"iisExpress": {
"applicationUrl": "http://localhost:3110/",
"sslPort": 44321
}
最重要的是,我将自己的应用程序的端口调整为也使用3110。
答案 1 :(得分:0)
似乎配置很好。这是一个工作示例供您参考。您可以检查退出代码。
[\[HttpGet\]
public IActionResult SignOut()
{
var callbackUrl = Url.Action(nameof(SignedOut), "Account", values: null, protocol: Request.Scheme);
return SignOut(
new AuthenticationProperties { RedirectUri = callbackUrl },
CookieAuthenticationDefaults.AuthenticationScheme,
OpenIdConnectDefaults.AuthenticationScheme);
}
\[HttpGet\]
public IActionResult SignedOut()
{
if (User.Identity.IsAuthenticated)
{
// Redirect to home page if the user is authenticated.
return RedirectToAction(nameof(HomeController.Index), "Home");
}
return View();
}][1]