从IdentityServer4 (v2)升级到Duende之后,当应用程序试图获得连接到API的令牌时,我会收到此错误:
error requesting access token for client default
日志中没有“错误”,但是令牌请求返回404:
Microsoft.AspNetCore.Routing.Matching.DfaMatcher:
|No candidates found for the request path '//connect/token'
Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware:
|Request did not match any endpoints
Duende.IdentityServer.Hosting.EndpointRouter:
|No endpoint entry found for request path: //connect/token
Microsoft.AspNetCore.Hosting.Diagnostics:
|Request finished HTTP/1.1 POST https://accounttest.veic.org//connect/token
application/x-www-form-urlencoded 29 - 404 - - 2.0641ms这个应用程序在Identity Server升级之前也能正常工作。
发布于 2022-09-13 13:14:06
事实证明,此错误与Duende Identity Server无关。问题是,将.NET升级为使用EndPoint路由可能会导致此问题。
app.UseMvcWithDefaultRoute之前的代码对于在URL中接受双斜杠比较友好。新的app.UseEndpoints路由不处理URL中的这个双斜杠并将其路由到一个操作。
下面是关于如何使用处理URL中的双斜杠的一个很好的答案。
https://stackoverflow.com/questions/73703657
复制相似问题