我们如何在 netlify 中发布 dotnet 核心应用程序?
how can we publish a dotnet core app in netlify?
我正在尝试在 netlify 中发布一个家庭作业应用程序。但是当我尝试部署它时出现错误。
这是部署日志。
9:25:34 PM: Build ready to start 9:25:36 PM: build-image version:
30f629161c0736b1a3ecd8b418e5eeffab5c0faf 9:25:36 PM: build-image tag:
v3.3.14 9:25:36 PM: buildbot version:
80440c4491d323247b9d55f7bea2ea6bc96ce8d2 9:25:36 PM: Fetching cached
dependencies 9:25:37 PM: Starting to download cache of 252.0MB 9:25:38
PM: Finished downloading cache in 1.125171279s 9:25:38 PM: Starting to
extract cache 9:25:47 PM: Finished extracting cache in 9.35605714s
9:25:47 PM: Finished fetching cache in 10.542038119s 9:25:47 PM:
Starting to prepare the repo for build 9:25:47 PM: Preparing Git
Reference refs/heads/master 9:25:48 PM: Starting build script 9:25:48
PM: Installing dependencies 9:25:49 PM: Started restoring cached node
version 9:25:51 PM: Finished restoring cached node version 9:25:52 PM:
v10.20.1 is already installed. 9:25:53 PM: Now using node v10.20.1
(npm v6.14.4) 9:25:53 PM: Started restoring cached build plugins
9:25:53 PM: Finished restoring cached build plugins 9:25:53 PM:
Attempting ruby version 2.6.2, read from environment 9:25:54 PM: Using
ruby version 2.6.2 9:25:54 PM: Using PHP version 5.6 9:25:54 PM: 5.2
is already installed. 9:25:54 PM: Using Swift version 5.2 9:25:54 PM:
Started restoring cached go cache 9:25:54 PM: Finished restoring
cached go cache 9:25:54 PM: go version go1.12 linux/amd64 9:25:54 PM:
go version go1.12 linux/amd64 9:25:54 PM: Installing missing commands
9:25:54 PM: Verify run directory 9:25:54 PM: Executing user command:
dotnet build 9:25:59 PM: Microsoft (R) Build Engine version
16.6.0+5ff7b0c9e for .NET Core 9:25:59 PM: Copyright (C) Microsoft Corporation. All rights reserved. 9:26:01 PM: Determining projects
to restore... 9:26:04 PM: Restored
/opt/build/repo/Electronic-Products-Market-Database-Management-System.csproj
(in 2.21 sec). 9:26:12 PM:
Electronic-Products-Market-Database-Management-System ->
/opt/build/repo/bin/Debug/netcoreapp3.1/Electronic-Products-Market-Database-Management-System.dll
9:26:12 PM: Electronic-Products-Market-Database-Management-System ->
/opt/build/repo/bin/Debug/netcoreapp3.1/Electronic-Products-Market-Database-Management-System.Views.dll
9:26:13 PM: Build succeeded. 9:26:13 PM: 0 Warning(s) 9:26:13 PM:
0 Error(s) 9:26:13 PM: Time Elapsed 00:00:13.37 9:26:13 PM: Skipping
functions preparation step: no functions directory set 9:26:13 PM:
Caching artifacts 9:26:13 PM: Started saving build plugins 9:26:13 PM:
Finished saving build plugins 9:26:13 PM: Started saving pip cache
9:26:20 PM: Finished saving pip cache 9:26:20 PM: Started saving emacs
cask dependencies 9:26:20 PM: Finished saving emacs cask dependencies
9:26:20 PM: Started saving maven dependencies 9:26:20 PM: Finished
saving maven dependencies 9:26:20 PM: Started saving boot dependencies
9:26:20 PM: Finished saving boot dependencies 9:26:20 PM: Started
saving go dependencies 9:26:20 PM: Finished saving go dependencies
9:26:20 PM: 9:26:20 PM: ** WARNING ** 9:26:20 PM: There are some
lingering processes even after the build process finished: 9:26:20 PM:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME
COMMAND 9:26:20 PM: buildbot 1285 27.9 0.6 28786512 187172 ?
Sl 18:26 0:03 /opt/buildhome/.dotnet/dotnet exec
/opt/buildhome/.dotnet/sdk/3.1.300/Roslyn/bincore/VBCSCompiler.dll
-pipename:32wBLnYyW2__v++qn9hs3AnpT7QZOsyeYeOn6hJdLao 9:26:20 PM: buildbot 1311 20.5 0.4 28228864 128840 ? Sl 18:26 0:02
/opt/buildhome/.dotnet/dotnet
/opt/buildhome/.dotnet/sdk/3.1.300/Sdks/Microsoft.NET.Sdk.Razor/tools/netcoreapp3.0/rzc.dll
server -p buildbot.XiJojHVTENZ4oaYBDyZsHSy+b 9:26:20 PM: Our builds do
not kill your processes automatically, so please make sure 9:26:20 PM:
that nothing is running after your build finishes, or it will be
marked as 9:26:20 PM: failed since something is still running. 9:26:20
PM: 9:26:20 PM: Build script success 9:26:20 PM: Starting to deploy
site from 'bin/Debug/netcoreapp3.1/publish' 9:26:20 PM: Creating
deploy tree 9:26:20 PM: Creating deploy upload records 9:26:20 PM: 0
new files to upload 9:26:20 PM: 0 new functions to upload 9:26:20 PM:
Starting post processing 9:26:20 PM: Post processing done 9:26:20 PM:
Site is live 9:27:02 PM: Finished processing build request in
1m25.952288421s
如果您知道在 netlify 上构建 dotnet 核心应用程序的指南,请告诉我。
这不可能。
我搜索了 Netilfy 文档。您所要求的是不可能的:https://community.netlify.com/t/support-guide-can-i-run-a-web-server-http-listener-and-or-database-at-netlify/3078:
How do I run a server/database at Netlify?
We often get questions about how to run a specific backend server or > database at Netlify. Examples of these types of questions include:
- How to I get my node HTTP listener to respond to requests?
- How do I start Mongo/MySQL/ running on the server?
- How can I SSH into my website?
We are here today to answer these questions - and the answer is: You can’t!
... the CDN/ADN at Netlify only serves static files....
原答案
以及调试问题的一些提示。
您是否完整阅读了错误消息?它说:
9:26:20 PM: ** WARNING **
9:26:20 PM: There are some lingering processes even after the build process finished
然后
9:26:20 PM: Our builds do not kill your processes automatically, so please make sure
9:26:20 PM: that nothing is running after your build finishes, or it will be marked as
9:26:20 PM: failed since something is still running.
它甚至告诉你什么是 运行ning:
9:26:20 PM: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
9:26:20 PM: buildbot 1285 27.9 0.6 28786512 187172 ? Sl 18:26 0:03 /opt/buildhome/.dotnet/dotnet exec /opt/buildhome/.dotnet/sdk/3.1.300/Roslyn/bincore/VBCSCompiler.dll -pipename:32wBLnYyW2__v++qn9hs3AnpT7QZOsyeYeOn6hJdLao
9:26:20 PM: buildbot 1311 20.5 0.4 28228864 128840 ? Sl 18:26 0:02 /opt/buildhome/.dotnet/dotnet /opt/buildhome/.dotnet/sdk/3.1.300/Sdks/Microsoft.NET.Sdk.Razor/tools/netcoreapp3.0/rzc.dll server -p buildbot.XiJojHVTENZ4oaYBDyZsHSy+b
看起来 2 dotnet
个进程在构建结束时仍在 运行ning,这使得构建失败。它们是 .NET Core 编译服务器 (VBCSCompiler.dll
) 和 Razor 页面编译器 (rzc.dll
)。
这是一个众所周知的问题:https://github.com/dotnet/sdk/issues/9487。引用该错误报告:
Use -p:UseRazorBuildServer=false
to disable the Razor (rzc) server.
Use -p:UseSharedCompilation=false
to disable the Roslyn (vbcscompiler) server.
所以将您的 dotnet build
(或 publish
)命令修改为 运行,如下所示:
dotnet build -p:UseRazorBuildServer=false -p:UseSharedCompilation=false [your other options]
我正在尝试在 netlify 中发布一个家庭作业应用程序。但是当我尝试部署它时出现错误。
这是部署日志。
9:25:34 PM: Build ready to start 9:25:36 PM: build-image version: 30f629161c0736b1a3ecd8b418e5eeffab5c0faf 9:25:36 PM: build-image tag: v3.3.14 9:25:36 PM: buildbot version: 80440c4491d323247b9d55f7bea2ea6bc96ce8d2 9:25:36 PM: Fetching cached dependencies 9:25:37 PM: Starting to download cache of 252.0MB 9:25:38 PM: Finished downloading cache in 1.125171279s 9:25:38 PM: Starting to extract cache 9:25:47 PM: Finished extracting cache in 9.35605714s 9:25:47 PM: Finished fetching cache in 10.542038119s 9:25:47 PM: Starting to prepare the repo for build 9:25:47 PM: Preparing Git Reference refs/heads/master 9:25:48 PM: Starting build script 9:25:48 PM: Installing dependencies 9:25:49 PM: Started restoring cached node version 9:25:51 PM: Finished restoring cached node version 9:25:52 PM: v10.20.1 is already installed. 9:25:53 PM: Now using node v10.20.1 (npm v6.14.4) 9:25:53 PM: Started restoring cached build plugins 9:25:53 PM: Finished restoring cached build plugins 9:25:53 PM: Attempting ruby version 2.6.2, read from environment 9:25:54 PM: Using ruby version 2.6.2 9:25:54 PM: Using PHP version 5.6 9:25:54 PM: 5.2 is already installed. 9:25:54 PM: Using Swift version 5.2 9:25:54 PM: Started restoring cached go cache 9:25:54 PM: Finished restoring cached go cache 9:25:54 PM: go version go1.12 linux/amd64 9:25:54 PM: go version go1.12 linux/amd64 9:25:54 PM: Installing missing commands 9:25:54 PM: Verify run directory 9:25:54 PM: Executing user command: dotnet build 9:25:59 PM: Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Core 9:25:59 PM: Copyright (C) Microsoft Corporation. All rights reserved. 9:26:01 PM: Determining projects to restore... 9:26:04 PM: Restored /opt/build/repo/Electronic-Products-Market-Database-Management-System.csproj (in 2.21 sec). 9:26:12 PM:
Electronic-Products-Market-Database-Management-System -> /opt/build/repo/bin/Debug/netcoreapp3.1/Electronic-Products-Market-Database-Management-System.dll 9:26:12 PM: Electronic-Products-Market-Database-Management-System -> /opt/build/repo/bin/Debug/netcoreapp3.1/Electronic-Products-Market-Database-Management-System.Views.dll 9:26:13 PM: Build succeeded. 9:26:13 PM: 0 Warning(s) 9:26:13 PM: 0 Error(s) 9:26:13 PM: Time Elapsed 00:00:13.37 9:26:13 PM: Skipping functions preparation step: no functions directory set 9:26:13 PM: Caching artifacts 9:26:13 PM: Started saving build plugins 9:26:13 PM: Finished saving build plugins 9:26:13 PM: Started saving pip cache 9:26:20 PM: Finished saving pip cache 9:26:20 PM: Started saving emacs cask dependencies 9:26:20 PM: Finished saving emacs cask dependencies 9:26:20 PM: Started saving maven dependencies 9:26:20 PM: Finished saving maven dependencies 9:26:20 PM: Started saving boot dependencies 9:26:20 PM: Finished saving boot dependencies 9:26:20 PM: Started saving go dependencies 9:26:20 PM: Finished saving go dependencies 9:26:20 PM: 9:26:20 PM: ** WARNING ** 9:26:20 PM: There are some lingering processes even after the build process finished: 9:26:20 PM: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND 9:26:20 PM: buildbot 1285 27.9 0.6 28786512 187172 ?
Sl 18:26 0:03 /opt/buildhome/.dotnet/dotnet exec /opt/buildhome/.dotnet/sdk/3.1.300/Roslyn/bincore/VBCSCompiler.dll -pipename:32wBLnYyW2__v++qn9hs3AnpT7QZOsyeYeOn6hJdLao 9:26:20 PM: buildbot 1311 20.5 0.4 28228864 128840 ? Sl 18:26 0:02 /opt/buildhome/.dotnet/dotnet /opt/buildhome/.dotnet/sdk/3.1.300/Sdks/Microsoft.NET.Sdk.Razor/tools/netcoreapp3.0/rzc.dll server -p buildbot.XiJojHVTENZ4oaYBDyZsHSy+b 9:26:20 PM: Our builds do not kill your processes automatically, so please make sure 9:26:20 PM: that nothing is running after your build finishes, or it will be marked as 9:26:20 PM: failed since something is still running. 9:26:20 PM: 9:26:20 PM: Build script success 9:26:20 PM: Starting to deploy site from 'bin/Debug/netcoreapp3.1/publish' 9:26:20 PM: Creating deploy tree 9:26:20 PM: Creating deploy upload records 9:26:20 PM: 0 new files to upload 9:26:20 PM: 0 new functions to upload 9:26:20 PM: Starting post processing 9:26:20 PM: Post processing done 9:26:20 PM: Site is live 9:27:02 PM: Finished processing build request in 1m25.952288421s
如果您知道在 netlify 上构建 dotnet 核心应用程序的指南,请告诉我。
这不可能。
我搜索了 Netilfy 文档。您所要求的是不可能的:https://community.netlify.com/t/support-guide-can-i-run-a-web-server-http-listener-and-or-database-at-netlify/3078:
How do I run a server/database at Netlify?
We often get questions about how to run a specific backend server or > database at Netlify. Examples of these types of questions include:
- How to I get my node HTTP listener to respond to requests?
- How do I start Mongo/MySQL/ running on the server?
- How can I SSH into my website?
We are here today to answer these questions - and the answer is: You can’t!
... the CDN/ADN at Netlify only serves static files....
原答案
以及调试问题的一些提示。
您是否完整阅读了错误消息?它说:
9:26:20 PM: ** WARNING **
9:26:20 PM: There are some lingering processes even after the build process finished
然后
9:26:20 PM: Our builds do not kill your processes automatically, so please make sure
9:26:20 PM: that nothing is running after your build finishes, or it will be marked as
9:26:20 PM: failed since something is still running.
它甚至告诉你什么是 运行ning:
9:26:20 PM: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
9:26:20 PM: buildbot 1285 27.9 0.6 28786512 187172 ? Sl 18:26 0:03 /opt/buildhome/.dotnet/dotnet exec /opt/buildhome/.dotnet/sdk/3.1.300/Roslyn/bincore/VBCSCompiler.dll -pipename:32wBLnYyW2__v++qn9hs3AnpT7QZOsyeYeOn6hJdLao
9:26:20 PM: buildbot 1311 20.5 0.4 28228864 128840 ? Sl 18:26 0:02 /opt/buildhome/.dotnet/dotnet /opt/buildhome/.dotnet/sdk/3.1.300/Sdks/Microsoft.NET.Sdk.Razor/tools/netcoreapp3.0/rzc.dll server -p buildbot.XiJojHVTENZ4oaYBDyZsHSy+b
看起来 2 dotnet
个进程在构建结束时仍在 运行ning,这使得构建失败。它们是 .NET Core 编译服务器 (VBCSCompiler.dll
) 和 Razor 页面编译器 (rzc.dll
)。
这是一个众所周知的问题:https://github.com/dotnet/sdk/issues/9487。引用该错误报告:
Use
-p:UseRazorBuildServer=false
to disable the Razor (rzc) server.Use
-p:UseSharedCompilation=false
to disable the Roslyn (vbcscompiler) server.
所以将您的 dotnet build
(或 publish
)命令修改为 运行,如下所示:
dotnet build -p:UseRazorBuildServer=false -p:UseSharedCompilation=false [your other options]