简体   繁体   English

将ASP.Net Core 3预览6发布到Azure

[英]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. 我正在尝试使用AspNetCore3 preview6.19307.2开发一个Web应用程序,我将在我的Azure WebApp上发布。

Isn't my first try to publish a preview version of AspNetCore 3. For an unknown reason, I can't. 是不是我第一次尝试发布AspNetCore 3的预览版本。由于未知原因,我不能。 The WebApp app said me that it can't start (Internal Server Error). WebApp应用程序告诉我它无法启动(内部服务器错误)。

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). 在Kudu控制台中,当我尝试AspNetCore3 Preview5时,我安装了ASP.NET Core 3.0 (x64) Runtime (版本3.0.0-preview5-19227-01)。

Now, since Preview6, no extension exists for this release. 现在,从Preview6开始,此版本不存在扩展。

I therefore tried to use the app on Docker. 因此我尝试在Docker上使用该应用程序。

I tried several dockerfiles including: 我尝试了几个dockerfiles,包括:

Generated by Visual Studio: 由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 更新1

In my last try, I've tried with VSCode and a terminal : docker build -t ideastudio -f Dockerfile . 在我的最后一次尝试中,我尝试使用VSCode和终端: 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. 最初,我的DOCKERFILE被添加到/src/Ideatudio.Web.Server文件夹中。 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 更新2

I have restore the original version of docker file (generated by Visual Studio) in D:\\repos\\IdeaStudio.Web\\src\\IdeaStudio.Web.Server\\DOCKERFILE : 我已在D:\\repos\\IdeaStudio.Web\\src\\IdeaStudio.Web.Server\\DOCKERFILE恢复原始版本的docker文件(由Visual Studio生成):

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\\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. 对于COPY ,第一个值是相对于当前dockerfile路径,第二个参数是相对于docker容器中的WORKDIR

Try the dockerfile below: 尝试下面的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 ["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"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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