Skip to content
Windows Hosting

How to Deploy ASP.NET Core on Plesk Windows Hosting

In this article10 sections

An ASP.NET Core application runs on Windows hosting through IIS, the Windows web server, and the ASP.NET Core Module that connects IIS to your app. Plesk manages the websites, the application pools and the SSL certificates, so you do not have to edit IIS by hand for most tasks. This guide shows how to publish an ASP.NET Core app, upload it to a Plesk website, set the runtime and the start command, and check that it starts. It also shows the single setting that decides whether the app runs at all.

SiteHarbour’s Windows hosting plans include Windows Server 2022, IIS 10, Plesk, .NET Core 6 to 10 and MS SQL databases, with free SSL and daily backups. The steps below assume one of those plans and an app that targets a version it supports.

Before you start

  • An ASP.NET Core app that builds on your computer and runs locally with dotnet run.
  • The target framework in your project file matches a runtime on the plan. Check the TargetFramework line in the .csproj file, such as net8.0.
  • A domain or subdomain pointed at the hosting, with DNS that has finished updating.
  • Your Plesk login and the FTP or SFTP details for the website.

Step 1: Publish the app for Windows

On your computer, publish a release build into a folder. The output contains the app DLL, its dependencies and the web.config file that IIS reads:

dotnet publish -c Release -o ./publish

Expected: a publish folder that contains a file named after your project with a .dll extension, a web.config file, and an appsettings.json file. If there is no web.config, the project was not configured for IIS. Add the file by publishing with the default ASP.NET Core template settings.

Do not upload the bin or obj folders, and do not upload your development secrets. Keep production settings out of the repository.

Step 2: Create the website in Plesk

In Plesk, open Websites & Domains and add the domain or subdomain if it does not exist yet. Choose the hosting option for the site, and select the PHP and .NET settings the panel offers. For an ASP.NET Core app, the important choice is the .NET runtime version in the website’s settings, which must be one the plan supports.

Expected: the website is listed under Websites & Domains with the domain shown. Plesk creates a folder for it, usually httpdocs.

Step 3: Upload the publish output

Upload the contents of the publish folder into the website’s httpdocs folder, not the folder itself. Use SFTP or the Plesk File Manager. The web.config file must sit directly in httpdocs, next to the app DLL. Upload the wwwroot folder too if your app serves static files from it.

Check the upload by listing the folder in Plesk. Expected: the DLL, web.config, appsettings.json and the other files from the publish output, all in httpdocs.

Step 4: Check the start command in web.config

The web.config file tells IIS how to start the app. The key element is aspNetCore. The arguments value must name your app’s DLL exactly as it appears in the folder:

<aspNetCore processPath="dotnet" arguments=".\MyApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />

Replace MyApp.dll with your DLL name. A wrong name here is the most common reason an app that built fine returns a 502.5 error. The logs and the error code are explained in how to fix ASP.NET Core 502.5 process failure on Windows hosting.

Step 5: Set the production configuration

Put the production connection string and other secrets in appsettings.Production.json on the server, or in environment variables set in the website’s settings. Do not commit them to source control. Set the environment name so the app loads the right file. In web.config, the environment is set by the ASPNETCORE_ENVIRONMENT variable:

<environmentVariables>
  <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
</environmentVariables>

Place this block inside the aspNetCore element, after its opening tag. Keep the exception page off in production, because it reveals internal details.

Step 6: Test the site

Open the domain in a browser. Expected: your app’s home page over HTTPS. If you see the Plesk default page, the files are in the wrong folder. If you see a 502.5 error, check the logs. If you see a 500 error, the app started but failed on a request, and the production configuration is the first place to look.

Test one page that uses the database, such as a list or a login. A page that works without the database can hide a connection string error.

Step 7: Add SSL and force HTTPS

Turn on the free SSL certificate for the domain in Plesk, then redirect HTTP to HTTPS. The redirect rule is covered in how to redirect HTTP to HTTPS on IIS. Set the certificate before you announce the site, because mixed content warnings are easy to miss.

Common mistakes

  • Wrong DLL name in web.config. The name is case sensitive and must match the file exactly.
  • Uploading the project folder. Upload the publish output only.
  • A runtime that the plan does not support. Build for a version the plan lists, and check the target framework before you publish.
  • Secrets in the repository. Keep production settings on the server.
  • Leaving detailed errors on. Production should show a plain error page.

Frequently asked questions

Do I need to install the .NET runtime on the server?

On SiteHarbour’s Windows plans, the supported runtimes are installed for you. Choose the version in Plesk. If your app is self-contained, the runtime is inside the publish output, but that makes the upload larger.

Can I deploy with Git instead of uploading files?

Yes. The steps are in how to deploy a website with Git in Plesk, which removes the manual upload.

Why does the app work locally but not on the server?

Usually a missing configuration value, a connection string that points at your development database, or a DLL name that does not match. The production logs show which.

Can I run more than one ASP.NET Core app on one plan?

Yes, each website has its own folder and application pool, within the limits of your plan.

Publishing an ASP.NET Core app for Plesk is four steps: publish the output, create the website, upload the publish folder, and check the web.config start command. Keep the secrets on the server, test one database page, and turn on HTTPS before you announce the site. For the database side, read how to connect ASP.NET Core to MS SQL Server.

Share this guide