Hi people
I’m trying to deploy Net 6 API on docker container (using Dockerfile created by Visual Studio itself)
I’m under Ubuntu 22.04 LTS
I get CORS error on Angular and 500 error on postman (when running Net 6 API on docker)
if running outside docker “$ dotnet run” then I get CORS error on Angular but it works on postman
I’m making petitions to a 2nd docker container (which has MS SQL)
both containers are running on same computer
What should I do to solve the issue?
that’s my Dockerfile >>
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["API.csproj", "."]
RUN dotnet restore "./API.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "API.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "API.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "API.dll"]