带SoapCore的.Net Core 3.1-如何在Docker中运行它?
通常情况下,终结点将使用:。 如何从运行在单独容器中的客户端访问此文件?我尝试获取net core容器的ip,并替换了localhost 这是我的Dockerfile:带SoapCore的.Net Core 3.1-如何在Docker中运行它?,.net,docker,soap,docker-compose,dockerfile,.net,Docker,Soap,Docker Compose,Dockerfile,通常情况下,终结点将使用:。 如何从运行在单独容器中的客户端访问此文件?我尝试获取net core容器的ip,并替换了localhost 这是我的Dockerfile: FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env WORKDIR /app # Copy csproj and restore as distinct layers COPY *.csproj ./ RUN dotnet restore # Copy everyt
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
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", "dotnet_soap_example.dll"]
我运行它时使用了:
docker build -t dotnet_soap_example .
docker run -p 5000:5000 dotnet_soap_example
结果是:
warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key {89888afb-2afd-4798-8474-9b71d743a397} may be persisted to storage in unencrypted form.
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://[::]:80
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: /app
另外,当我创建项目时,我使用了:
dotnet new web
我安装了SoapCore NuGet软件包:
dotnet add package SoapCore
是否需要将此NuGet安装添加到Dockerfile中?修复了它。将
5000:5000
替换为5000:80