无法从容器网络内的OpenID获取配置

时间:2019-07-22 19:52:43

标签: docker docker-compose

我有一个微服务应用程序,每个应用程序都在其自己的容器中运行。服务之一是IdentityServer4应用程序。我已将身份验证添加到ClientService,其中AddJwtBearer选项的Authory属性设置为运行IdentityServer的容器的地址。

当我尝试向ClientService发出请求时,出现以下错误:

System.InvalidOperationException: IDX20803: Unable to obtain configuration 
from: 'http://netcompany_identityService_1:80/.well-known/openid- 
configuration'. ---> System.IO.IOException: IDX20804: Unable to retrieve 
document from: 'http://netcompany_identityService_1:80/.well-known/openid- 
configuration'. ---> System.Net.Http.HttpRequestException: No such device or 
address ---> System.Net.Sockets.SocketException: No such device or address

据我了解,我必须使用容器名称作为地址,同时还要连接到数据库,该数据库也是网络中的容器:

...
"ConnectionString":"Server=netcompany_sqlserver_1,1433;Database=IdentityDb;User Id=sa;Password=Pass@word;",
...

有人知道为什么这行不通吗,我该怎么办?

0 个答案:

没有答案