Search code examples
.netasp.net-core.net-corebuildnetlify

how can we publish a dotnet core app in netlify?


i am trying to publish an app for homework in netlify. but when i try to deploy it gives error.

this is deploy log.

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

if you know a guide for building dotnet core apps on netlify let me know.


Solution

  • It's not possible.

    I searched Netilfy docs. What you are asking for is not possible: 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....

    Original Answer

    And some hints to debug the issue.

    Did you read the error message in its entirety? It says:

    9:26:20 PM: ** WARNING ** 
    9:26:20 PM: There are some lingering processes even after the build process finished
    

    And then

    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.
    

    It even tells you what's running:

    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
    

    It looks like 2 dotnet processes are still running at the end of your build and that makes the build as failed. These are the .NET Core compile server (VBCSCompiler.dll) and the Razor pages compiler (rzc.dll).

    This is a pretty well known issue: https://github.com/dotnet/sdk/issues/9487. To quote that bug report:

    Use -p:UseRazorBuildServer=false to disable the Razor (rzc) server.

    Use -p:UseSharedCompilation=false to disable the Roslyn (vbcscompiler) server.

    So modify your dotnet build (or publish) command to run like this:

    dotnet build -p:UseRazorBuildServer=false -p:UseSharedCompilation=false [your other options]