user3160227
user3160227

Reputation: 105

ASP.NET Core Web application 403 error after deploy

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:

I zip the files in bin\Release\netcoreapp3.1\publish 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

Upvotes: 0

Views: 1449

Answers (2)

Rodney Ellis
Rodney Ellis

Reputation: 807

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

Upvotes: 0

user3160227
user3160227

Reputation: 105

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...

Upvotes: 0

Related Questions