I am running my Maui Android app on a real device. It needs to connect to the apigateway of a microservices project. The apigateway along with all the microservices are run in docker. I am getting the above error for the when the app tries to connect to the apigateway project. appsettings.Development.json
"ApiSettings": {
"BaseUrl": "http://192.168.1.15:3000",
"TenantId": "f8d34845-3f68-4d95-b39b-abcd1234"
}
This is being read in the MauiProgram.cs file
// Read the BaseUrl from configuration; fallback to Docker gateway if missing
var baseUrl = builder.Configuration["ApiSettings:BaseUrl"] ?? "http://192.168.1.15:3000";
The request is being made like this
// Fetch a flat list from the API (Gateway)
var allMenus = await _httpClient.GetFromJsonAsync<List<SharedMenusDto>>(menusEndpoint)
?? new List<SharedMenusDto>();
The endpoint is correct, and as far as I understand, the port number is also correct. The docker file of the apigateway project
# Use official .NET 9 runtime as base
FROM mcr.microsoft/dotnet/aspnet:9.0.2 AS base
WORKDIR /app
EXPOSE 3000
# Build stage
FROM mcr.microsoft/dotnet/sdk:9.0.102 AS build
WORKDIR /src
COPY ["ApiGateway/ApiGateway.csproj", "ApiGateway/"]
RUN dotnet restore "ApiGateway/ApiGateway.csproj"
# Copy and build the app
COPY . .
WORKDIR "/src/ApiGateway"
ARG Mode=Debug
RUN echo "$Mode"
RUN dotnet publish -c $Mode -o /app/publish
# Final runtime container
FROM base AS final
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "ApiGateway.dll"]
The docker compose project
apigateway:
container_name: apigateway
build:
context: .
dockerfile: ApiGateway/Dockerfile
args:
- Mode=Debug
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "3000:8080"
volumes:
- .:/app
I dont know what else to provide. I have tried changing the port to 8080 which gives a 404. Actually, the project once ran with these same settings. I dont know what changed that it doesn't run anymore.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744236839a4564510.html
评论列表(0条)