Muneer Nasir
Muneer Nasir

Reputation: 93

Identity Server4: Unable to obtain configuration from 'http://localhost:44338/.well-known/openid-configuration

I'm working on microservices in .Net core 3.1 with docker-compose. we are using Linux based Docker containers. MVC Client application is perfectly running in IIS express along with Identity 4 API, when I run microservices in docker-compose then I am getting error in the client application.

{"StatusCode":500,"Message":"Internal Server Error."}

In the MVC client container, I checked the container's log. I got the below error.

Unable to obtain configuration from 'http://localhost:44338/.well-known/openid-configuration'

this above URL is representing Identity Server 4 that is also running in a container. The sequence of my docker-compose is

version: '3.4'    
 services:     
 identity.api:
     environment:
       - ASPNETCORE_URLS=https://+:443;http://+:80
       - MvcClient=http://localhost:44353
    ports:
      - "44338:80"
      - "443"

    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
      - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
  rinmvc:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=https://+:443;http://+:80;
      - ASPNETCORE_URLS=http://0.0.0.0:80
      - IdentityUrl=http://localhost:44338
    ports:

      - "44353:80"
      - "443"

    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
      - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro

Upvotes: 1

Views: 686

Answers (1)

Muneer Nasir
Muneer Nasir

Reputation: 93

After spending few days on this issue, I got the correct solution. I've modified my docker-compose.override file as below:

version: '3.4'

services:
  rabbitmq:
    ports:
      - "15672:15672"
      - "5672:5672"

  identity.api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=http://+:80
      - MvcClient=http://rinmvc  
    ports:
      - "44338:80"
    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
      - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro

  rinmvc:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=http://+:80
      - IdentityUrl=http://identity.api
    ports:
      - "44353:80"
    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
      - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro  

Upvotes: 1

Related Questions