Cnfzh 软件博客

中间件顺序:一次 404 排查

空 body 的 404 背后,是重执行与路由的先后问题。

现象

Blazor 站点访问不存在路径,返回 404 但页面空白。

原因

状态码页重执行会重新跑一遍管道,放在路由之后就拿不到路由信息了。

结论

页面的错误处理要在 UseRouting 之前,API 的在其之后。

评论 0

还没有评论,来说两句吧。

提交前需验证邮箱,验证码 10 分钟内有效。

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.