skip to Main Content

I create an ASP.NET Core Web application(.NET Core 3.1) sample project, and I can run it in localhost.

I install dotnet sdk(dotnet –version 3.1.422) and runtime on DigitalOcean Droplet VPS(Ubuntu 20.04, link) and publish it to VPS, but I got 403 error on every page.

I can browse static files like https://mydomain/wwwroot/css/site.css, but another path like / or /privacy only shows 403 errors. How can I fix it? Tks.

My publish option in VS2022:

  • publish type: folder
  • target framework: netcoreapp 3.1
  • deployment mode: framework-dependent/self-contained both tried
  • target runtime: portable

I zip the files in binReleasenetcoreapp3.1publish and upload them via Plesk file manager.

enter image description here


I use cd /var/www/vhosts/mydomain/httpdocs/ and dotnet run

Then I got an error message:

Couldn’t find a project to run. Ensure a project exists in /var/www/vhosts/mydomain/httpdocs, or pass the path to the project using –project.


I use cd /var/www/vhosts/mydomain/httpdocs/ and dotnet WebApplication3.dll

But it still shows 403 when I browse https://mydomain

info: Microsoft.Hosting.Lifetime[0] Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0] Now listening on: https://localhost:5001
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:/var/www/vhosts/mydomain/httpdocs

2

Answers


  1. Chosen as BEST ANSWER

    I install Plesk .NET Toolkit then setting the sample site like this below.

    enter image description here

    It works! The website runs but I still don't know how to setting the same thing via terminal...


  2. I just had this issue too, with running my .Net Core Web App on a Plesk hosted server.

    Turns out it was the Web Application Firewall. I turned it from On to Off, and it’s now working on all browsers:

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search