简体   繁体   中英

Publish an ASP.Net Core 3 preview 6 to Azure

I'm trying to develop a web application using AspNetCore3 preview6.19307.2 and I would to publish on my Azure WebApp.

Isn't my first try to publish a preview version of AspNetCore 3. For an unknown reason, I can't. The WebApp app said me that it can't start (Internal Server Error).

In Kudu console, when I've try AspNetCore3 Preview5, I've install the ASP.NET Core 3.0 (x64) Runtime (version 3.0.0-preview5-19227-01).

Now, since Preview6, no extension exists for this release.

I therefore tried to use the app on Docker.

I tried several dockerfiles including:

Generated by Visual Studio:

FROM mcr.microsoft.com/dotnet/core/runtime:3.0-buster-slim-arm64v8 AS base
WORKDIR /app
EXPOSE 80

# Install ASP.NET Core
ENV ASPNETCORE_VERSION 3.0.0-preview6.19307.2

FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
WORKDIR /src
COPY ["IdeaStudio.Web.Server/IdeaStudio.Web.Server.csproj", "IdeaStudio.Web.Server/"]
COPY ["IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj", "IdeaStudio.Web.Client/"]
COPY ["IdeaStudio.Web.Shared/IdeaStudio.Web.Shared.csproj", "IdeaStudio.Web.Shared/"]
RUN dotnet restore "IdeaStudio.Web.Server/IdeaStudio.Web.Server.csproj"
COPY . .
WORKDIR "/src/IdeaStudio.Web.Server"
RUN dotnet build "IdeaStudio.Web.Server.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "IdeaStudio.Web.Server.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "IdeaStudio.Web.Server.dll"]

The first one logs:

1>------ Build started: Project: IdeaStudio.Web.Server, Configuration: Debug Any CPU ------
...
1>docker run -dt -v "C:\Users\andre\vsdbg\vs2017u5:/remote_debugger:rw" -v "D:\Repos\IdeaStudio.Web\IdeaStudio.Web.Server:/app" -v "C:\Users\andre\.nuget\packages\:/root/.nuget/fallbackpackages3" -v "C:\Microsoft\Xamarin\NuGet\:/root/.nuget/fallbackpackages" -v "C:\Program Files\dotnet\sdk\NuGetFallbackFolder:/root/.nuget/fallbackpackages2" -e "DOTNET_USE_POLLING_FILE_WATCHER=1" -e "ASPNETCORE_ENVIRONMENT=Development" -e "NUGET_PACKAGES=/root/.nuget/fallbackpackages3" -e "NUGET_FALLBACK_PACKAGES=/root/.nuget/fallbackpackages;/root/.nuget/fallbackpackages2;/root/.nuget/fallbackpackages3" -p 50793:80 --entrypoint tail ideastudiowebserver:dev -f /dev/null
1>259a71fe9c5e97288455ce841990821bcc4745ac11016b140e36950a6a49e1a3
1>docker: Error response from daemon: driver failed programming external connectivity on endpoint amazing_cocks (56655f71f121511a010d160258f20026756cf13a08014626064fdebc94709c1d): Error starting userland proxy: mkdir /port/tcp:0.0.0.0:50793:tcp:172.17.0.2:80: input/output error.
1>C:\Users\andre\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.7.11\build\Container.targets(196,5): error CTP1002: An error occurred while attempting to run Docker container.

Update 1

In my last try, I've tried with VSCode and a terminal : docker build -t ideastudio -f Dockerfile .

I've another error:

error MSB6003: The specified task executable "node" could not be run. System.ComponentModel.Win32Exception (2): No such file or directory [/src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj]

Initially, my DOCKERFILE was added in /src/Ideatudio.Web.Server folder. Before this message, the tree of my files looked like

- IdeaStudio.Web.Client\ (csproj and files)
- IdeaStudio.Web.Server\ (csproj and files)
    - DOCKERFILE
- IdeaStudio.Web.Shared\...

After:

- IdeaStudio.Web.Client\ (csproj and files)
- IdeaStudio.Web.Server\ (csproj and files)
- IdeaStudio.Web.Shared\...
- DOCKERFILE

I've the same error...

Update 2

I have restore the original version of docker file (generated by Visual Studio) in D:\\repos\\IdeaStudio.Web\\src\\IdeaStudio.Web.Server\\DOCKERFILE :

FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
WORKDIR /src
COPY ["IdeaStudio.Web.Server/IdeaStudio.Web.Server.csproj", "IdeaStudio.Web.Server/"]
COPY ["IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj", "IdeaStudio.Web.Client/"]
COPY ["IdeaStudio.Web.Shared/IdeaStudio.Web.Shared.csproj", "IdeaStudio.Web.Shared/"]
RUN dotnet restore "IdeaStudio.Web.Server/IdeaStudio.Web.Server.csproj"
COPY . .
WORKDIR "/src/IdeaStudio.Web.Server"
RUN dotnet build "IdeaStudio.Web.Server.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "IdeaStudio.Web.Server.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "IdeaStudio.Web.Server.dll"]

My logs:

D:\Repos\IdeaStudio.Web\src\IdeaStudio.Web.Server>docker build -t ideastudioserver -f Dockerfile .
Sending build context to Docker daemon  3.224MB
Step 1/18 : FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
 ---> 535a4f32905a
Step 2/18 : WORKDIR /app
 ---> Running in c949c41906a2
Removing intermediate container c949c41906a2
 ---> 7e4f125c7680
Step 3/18 : EXPOSE 80
 ---> Running in 78304b88cdeb
Removing intermediate container 78304b88cdeb
 ---> b3498af84ab1
Step 4/18 : FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
 ---> 1fe3bc74dd1b
Step 5/18 : WORKDIR /src
 ---> Using cache
 ---> ac9cfd234501
Step 6/18 : COPY ["IdeaStudio.Web.Server/IdeaStudio.Web.Server.csproj", "IdeaStudio.Web.Server/"]
COPY failed: stat /var/lib/docker/tmp/docker-builder106022311/IdeaStudio.Web.Server/IdeaStudio.Web.Server.csproj: no such file or directory

When I move it to D:\\repos\\IdeaStudio.Web\\src\\DOCKERFILE :

D:\Repos\IdeaStudio.Web\src>docker build -t ideastudioserver -f Dockerfile .
Sending build context to Docker daemon  48.93MB
Step 1/18 : FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
 ---> 535a4f32905a
Step 2/18 : WORKDIR /app
 ---> Using cache
 ---> 7e4f125c7680
Step 3/18 : EXPOSE 80
 ---> Using cache
 ---> b3498af84ab1
Step 4/18 : FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
 ---> 1fe3bc74dd1b
Step 5/18 : WORKDIR /src
 ---> Using cache
 ---> ac9cfd234501
Step 6/18 : COPY ["IdeaStudio.Web.Server/IdeaStudio.Web.Server.csproj", "IdeaStudio.Web.Server/"]
 ---> c258e7588817
Step 7/18 : COPY ["IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj", "IdeaStudio.Web.Client/"]
 ---> 73d1ce9fcd0a
Step 8/18 : COPY ["IdeaStudio.Web.Shared/IdeaStudio.Web.Shared.csproj", "IdeaStudio.Web.Shared/"]
 ---> fb4cdea5ed62
Step 9/18 : RUN dotnet restore "IdeaStudio.Web.Server/IdeaStudio.Web.Server.csproj"
 ---> Running in f7452d7650cf
  Restore completed in 5.7 sec for /src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj.
  Restore completed in 4.23 ms for /src/IdeaStudio.Web.Shared/IdeaStudio.Web.Shared.csproj.
  Restore completed in 6.17 sec for /src/IdeaStudio.Web.Server/IdeaStudio.Web.Server.csproj.
Removing intermediate container f7452d7650cf
 ---> 5720a6dea18d
Step 10/18 : COPY . .
 ---> 86ef33c9acaf
Step 11/18 : WORKDIR "/src/IdeaStudio.Web.Server"
 ---> Running in a2581bbcbece
Removing intermediate container a2581bbcbece
 ---> be52c244051d
Step 12/18 : RUN dotnet build "IdeaStudio.Web.Server.csproj" -c Release -o /app
 ---> Running in e43ee85a4a35
Microsoft (R) Build Engine version 16.2.0-preview-19278-01+d635043bd for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 25.27 ms for /src/IdeaStudio.Web.Server/IdeaStudio.Web.Server.csproj.
  Restore completed in 24.18 ms for /src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj.
  Restore completed in 0.65 ms for /src/IdeaStudio.Web.Shared/IdeaStudio.Web.Shared.csproj.
/usr/share/dotnet/sdk/3.0.100-preview6-012264/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets(158,5): message NETSDK1057: You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview [/src/IdeaStudio.Web.Server/IdeaStudio.Web.Server.csproj]
/usr/share/dotnet/sdk/3.0.100-preview6-012264/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets(158,5): message NETSDK1057: You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview [/src/IdeaStudio.Web.Shared/IdeaStudio.Web.Shared.csproj]
  IdeaStudio.Web.Shared -> /app/IdeaStudio.Web.Shared.dll
/root/.nuget/packages/microsoft.typescript.msbuild/3.5.2/tools/Microsoft.TypeScript.targets(543,5): error MSB6003: The specified task executable "node" could not be run. System.ComponentModel.Win32Exception (2): No such file or directory [/src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj]
/root/.nuget/packages/microsoft.typescript.msbuild/3.5.2/tools/Microsoft.TypeScript.targets(543,5): error MSB6003:    at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean 
setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec) [/src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj]
/root/.nuget/packages/microsoft.typescript.msbuild/3.5.2/tools/Microsoft.TypeScript.targets(543,5): error MSB6003:    at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) [/src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj]
/root/.nuget/packages/microsoft.typescript.msbuild/3.5.2/tools/Microsoft.TypeScript.targets(543,5): error MSB6003:    at System.Diagnostics.Process.Start() [/src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj]
/root/.nuget/packages/microsoft.typescript.msbuild/3.5.2/tools/Microsoft.TypeScript.targets(543,5): error MSB6003:    at Microsoft.Build.Utilities.ToolTask.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [/src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj]    
/root/.nuget/packages/microsoft.typescript.msbuild/3.5.2/tools/Microsoft.TypeScript.targets(543,5): error MSB6003:    at TypeScript.Tasks.VsTsc.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [/src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj]
/root/.nuget/packages/microsoft.typescript.msbuild/3.5.2/tools/Microsoft.TypeScript.targets(543,5): error MSB6003:    at Microsoft.Build.Utilities.ToolTask.Execute() [/src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj]

Build FAILED.

/root/.nuget/packages/microsoft.typescript.msbuild/3.5.2/tools/Microsoft.TypeScript.targets(543,5): error MSB6003: The specified task executable "node" could not be run. System.ComponentModel.Win32Exception (2): No such file or directory [/src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj]
/root/.nuget/packages/microsoft.typescript.msbuild/3.5.2/tools/Microsoft.TypeScript.targets(543,5): error MSB6003:    at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean 
setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec) [/src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj]
/root/.nuget/packages/microsoft.typescript.msbuild/3.5.2/tools/Microsoft.TypeScript.targets(543,5): error MSB6003:    at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) [/src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj]
/root/.nuget/packages/microsoft.typescript.msbuild/3.5.2/tools/Microsoft.TypeScript.targets(543,5): error MSB6003:    at System.Diagnostics.Process.Start() [/src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj]
/root/.nuget/packages/microsoft.typescript.msbuild/3.5.2/tools/Microsoft.TypeScript.targets(543,5): error MSB6003:    at Microsoft.Build.Utilities.ToolTask.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [/src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj]    
/root/.nuget/packages/microsoft.typescript.msbuild/3.5.2/tools/Microsoft.TypeScript.targets(543,5): error MSB6003:    at TypeScript.Tasks.VsTsc.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [/src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj]
/root/.nuget/packages/microsoft.typescript.msbuild/3.5.2/tools/Microsoft.TypeScript.targets(543,5): error MSB6003:    at Microsoft.Build.Utilities.ToolTask.Execute() [/src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:03.96
The command '/bin/sh -c dotnet build "IdeaStudio.Web.Server.csproj" -c Release -o /app' returned a non-zero code: 1

Your issue is related with the relative path. For COPY , first value is relative the current dockerfile path and the second parameter is relative to the WORKDIR in the docker container.

Try the dockerfile below:

    FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
    WORKDIR /app
    EXPOSE 80

    FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
    WORKDIR /src
    COPY ["src/IdeaStudio.Web.Server/IdeaStudio.Web.Server.csproj", "IdeaStudio.Web.Server/"]
    COPY ["src/IdeaStudio.Web.Client/IdeaStudio.Web.Client.csproj", "IdeaStudio.Web.Client/"]
    COPY ["src/IdeaStudio.Web.Shared/IdeaStudio.Web.Shared.csproj", "IdeaStudio.Web.Shared/"]
    RUN dotnet restore "IdeaStudio.Web.Server/IdeaStudio.Web.Server.csproj"
    COPY "src" .
    WORKDIR "/src/IdeaStudio.Web.Server"
    RUN dotnet build "IdeaStudio.Web.Server.csproj" -c Release -o /app

    FROM build AS publish
    RUN dotnet publish "IdeaStudio.Web.Server.csproj" -c Release -o /app

    FROM base AS final
    WORKDIR /app
    COPY --from=publish /app .
    ENTRYPOINT ["dotnet", "IdeaStudio.Web.Server.dll"]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM