Home > Blockchain >  ASP.NET Core API Docker: Failed to load resource: the server responded with a status of 404 (Not Fou
ASP.NET Core API Docker: Failed to load resource: the server responded with a status of 404 (Not Fou

Time:07-02

I cloned this git repo and while it works locally, I receive a 404 error when I Dockerize the API:

Local

Docker

docker ps

Below is the Dockerfile

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
EXPOSE 80
EXPOSE 443
EXPOSE 5000
EXPOSE 8080
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore

# Copy everything else and build
COPY . ./
RUN dotnet build
RUN dotnet publish -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "TodoApi.dll"]

Any suggestions?

CodePudding user response:

open your app.js from wwwroot/app/scripts/app.js

it is problem case sensitive in linux environment.

and modify like this.

  $routeProvider.when("/Home", {
    controller: "todoListCtrl",
    templateUrl: "/app/views/TodoList.html",
}).otherwise({ redirectTo: "/Home" });

Solution also provided as part of the issue https://github.com/Azure-Samples/dotnet-core-api/issues/1

  • Related