docker - "unexpected end of stream on com.android.okhttp.Address@ec4770bb" - Stack Overflow

I am running my Maui Android app on a real device. It needs to connect to the apigateway of a microserv

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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信