问题
在用 IdentityServer 和 ASP.NET Core 实现SSO的过程中,从客户端跳转到SSO认证中心的时候,认证中心报了如下错误。
Error.
An error occurred while processing your request.
Development Mode
Swapping to Development environment will display more detailed information about the error that occurred.
Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment
can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting
the application.
使用谷歌直男翻译之后变成这样:
错误。
处理您的请求时发生错误。
发展模式交换到开发环境将显示有关发生的错误的更详细信息。
不应在已部署的应用程序中启用开发环境,因为它可能导致向最终用户显示异常的敏感信息。对于本地调试,可以
通过将ASPNETCORE_ENVIRONMENT环境变量设置为Development并重新启动应用程序来启用开发环境。
是因为我没有开启Development模式吗?这样想的我去到launchSettings.json文件里面想进行更改,却发现本来就是Development模式。
环境已经是Development模式了,那为什么还是会出现这样的问题,在不断找的过程中,终于被我找到了万恶之源的所在地。
原因
万恶之源就是我(划掉)SSO认证中心所做的配置应用范围,我发现我写的应用范围写错了。
在红框里面,我把http://www.a.cn:5002/signin-oidc 写成了http://www.a.c:5002/signin-oidc ,就因为这样IdentityServer认为会泄露用户的敏感信息暴露,所以才会报这个错误。
解决方法
解决方法也很简单,只要把定义错的范围改回来就行了,我这里则是把a.c:5002修改成a.cn:5002就解决了