在身份验证服务器身份验证重定向到我的应用程序后,它给出了
例外:关联失败。位置不明
现在因为我正在使用SPA。这条路线绝对不存在。但问题是如何定义一个。那我应该怎么做
我使用了Identityserver的混合流。
https://localhost:44375/signin-oidc
我提到了以下内容。
但在上面的链接中有一个SPA中间件。这是VueCliMiddleWare。 (对我而言,这就是创造问题。路线。)
(对于其余的路由,它按照以下代码返回索引文件。只有这个/ oidc-client路径不起作用。)
app.Use(async (context, next) =>
{
await next();
if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value))
{
context.Request.Path = "/index.html";
await next();
}
})
.UseDefaultFiles(new DefaultFilesOptions { DefaultFileNames = new List<string> { "index.html" } });
如果我定义以下
routes.MapSpaFallbackRoute(
name: "spa - fallback",
defaults: new { controller = "CatchAll", action = "Index" });
然后,此路由重定向到该控制器。但在那里我无法返回索引文件。
根据以下链接提到国家财产缺失。
但我仍然无法弄清楚如何设置一个。
因此,如果某人有最终答案,请不要将其标记为已接受
https://github.com/aspnet/AspNetCore/issues/7501#issuecomment-464082989
更新:
以下是答案。