Hello.
I developed Rest API on ASP.net
core and ASP MVC frontend.
I published 2 containers using docker compose(same network).
When I try to send request from frontend inside of docker I recieve error but if I try to send request from postman(containers are running), the request pass and return correct answer.
docker-compose
services:
backend:
build:
context: ./Backend/.
ports:
- '8080:80'
container_name:
backend
networks:
- network1
frontend:
build:
context: ./Frontend/Tool/.
ports:
- '8081:80'
container_name:
frontend
depends_on:
- backend
networks:
- network1
networks:
network1:
driver: bridge
I guess the problem on frontend
private string apiUrl = $"http://localhost/api/vehicle"
;(local host I changed to 8080 but I had same problem)
…
var response = await _httpClient.PostAsJsonAsync(url, model);