I have a GRPC service built with .net 6 and the docker file is also created using visual studio docker generation tool.I have created a docker-compose file for the same and the docker compose file is below.
schedular.api:
environment:
- ASPNETCORE_ENVIRONMENT=Development
#- ASPNETCORE_URLS=http://+:50051
#- "Kestrel__Endpoints__Url=http://*:5000"
- Kestrel__EndpointDefaults__Protocols=Http2
ports:
- "9004:80"
- "50051:50051"
volumes:
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
When I am trying to check where GRPC service is running or not using the endpoint
http://localhost:9004/ or http://localhost:50051/ it is not accessible
I have inspected the log and no error is there.The log is below.
2023-10-10 18:08:17 info: Hangfire.SqlServer.SqlServerObjectsInstaller[0]
2023-10-10 18:08:17 Start installing Hangfire SQL objects...
2023-10-10 18:08:20 info: Hangfire.SqlServer.SqlServerObjectsInstaller[0]
2023-10-10 18:08:20 Hangfire SQL objects installed.
2023-10-10 18:08:20 info: Microsoft.Hosting.Lifetime[14]
2023-10-10 18:08:20 Now listening on: http://[::]:80
2023-10-10 18:08:20 info: Hangfire.BackgroundJobServer[0]
2023-10-10 18:08:20 Starting Hangfire Server using job storage: 'SQL Server: tcp:subapp.database.windows.net,1433@hangfiredb'
2023-10-10 18:08:20 info: Hangfire.BackgroundJobServer[0]
2023-10-10 18:08:20 Using the following options for SQL Server job storage: Queue poll interval: 00:00:00.
2023-10-10 18:08:20 info: Hangfire.BackgroundJobServer[0]
2023-10-10 18:08:20 Using the following options for Hangfire Server:
2023-10-10 18:08:20 Worker count: 20
2023-10-10 18:08:20 Listening queues: 'default'
2023-10-10 18:08:20 Shutdown timeout: 00:00:15
2023-10-10 18:08:20 Schedule polling interval: 00:00:15
2023-10-10 18:08:20 info: MassTransit[0]
2023-10-10 18:08:20 Bus started: sb://aec-notification.servicebus.windows.net/
2023-10-10 18:08:20 info: Microsoft.Hosting.Lifetime[0]
2023-10-10 18:08:20 Application started. Press Ctrl+C to shut down.
2023-10-10 18:08:20 info: Microsoft.Hosting.Lifetime[0]
2023-10-10 18:08:20 Hosting environment: Development
2023-10-10 18:08:20 info: Microsoft.Hosting.Lifetime[0]
2023-10-10 18:08:20 Content root path: /app/
2023-10-10 18:08:21 info: Hangfire.Server.BackgroundServerProcess[0]
2023-10-10 18:08:21 Server 543008160f13:1:c94584e3 successfully announced in 522.4092 ms
2023-10-10 18:08:21 info: Hangfire.Server.BackgroundServerProcess[0]
2023-10-10 18:08:21 Server 543008160f13:1:c94584e3 is starting the registered dispatchers: ServerWatchdog, ServerJobCancellationWatcher, ExpirationManager, CountersAggregator, SqlServerHeartbeatProcess, Worker, DelayedJobScheduler, RecurringJobScheduler...
2023-10-10 18:08:21 info: Hangfire.Server.BackgroundServerProcess[0]
2023-10-10 18:08:21 Server 543008160f13:1:c94584e3 all the dispatchers started
Below is the Dockerfile.
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 50051
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["schedular-service/src/Schedular.Api/Schedular.Api.csproj", "schedular-service/src/Schedular.Api/"]
COPY ["schedular-service/src/Schedular.Infrastructure/Schedular.Infrastructure.csproj", "schedular-service/src/Schedular.Infrastructure/"]
COPY ["schedular-service/src/Schedular.Api/Services/ScheduleService.cs", "schedular-service/src/Schedular.Api/Services/"]
COPY ["infra/EventBus.Messages/EventBus.Messages.csproj", "infra/EventBus.Messages/"]
COPY ["schedular-service/src/Schedular.Application/Schedular.Application.csproj", "schedular-service/src/Schedular.Application/"]
COPY ["schedular-service/src/Schedular.Core/Schedular.Core.csproj", "schedular-service/src/Schedular.Core/"]
RUN dotnet restore "schedular-service/src/Schedular.Api/Schedular.Api.csproj"
COPY . .
WORKDIR "/src/schedular-service/src/Schedular.Api"
RUN dotnet build "Schedular.Api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Schedular.Api.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Schedular.Api.dll"]
I am not able to find why it is not exposed. Can any one help me on this? I am suspecting might be some SSL issue.