ASP.NET Core on Windows hosting

Skip to main content
Du bist hier:
Drucken

ASP.NET Core on Windows hosting

You can run ASP.NET Core applications on our Windows hosting packages. The servers have the current ASP.NET Core Hosting Bundles installed (currently .NET 8 to .NET 10), including ASP.NET Core Module V2 (ANCM) and the runtime in 32 and 64 bit. No special settings in Plesk or IIS are needed.

32 or 64 bit?

Each domain runs in its own application pool with its own user, separate from your other domains. The pool is usually set to 32 bit: in that case publish your application for win-x86. If it is set to 64 bit, publish for win-x64. Both work framework-dependent or self-contained. If the target platform does not match the pool, the application does not start. If you would like the pool switched, contact us via a ticket.

Setting up the application

  1. Upload the published application via FTP or the Plesk File Manager to the document root of your domain. Make sure the wwwroot folder with all its subfolders is uploaded as well.
  2. In Plesk, open the «.NET Core» tile of your domain. There you set the application startup file, store environment variables and restart the application.

Error 500.30 «ASP.NET Core app failed to start»

This message means that your application crashes on startup. The cause is almost always in the application itself, for example a missing folder (often wwwroot), a missing configuration file or a wrong target platform (see «32 or 64 bit?»). How to see the exact error message:

  1. In Plesk, open the «.NET Core» tile and, under «Logs», enable «Redirect stdout/stderr to a file».
  2. Select the «logs» folder at the top level of your subscription as the directory. It is outside the document root, cannot be accessed from the outside, and your application is allowed to write there.
  3. Open the website again. You will now find a file with the error message in the «logs» folder.

Alternatively, set stdoutLogEnabled=”true” in the aspNetCore section of web.config and specify a folder the application may write to under stdoutLogFile. As the log may contain internal details, switch it off again after troubleshooting.

Storing data and keys securely

  • The App_Data folder in the document root is never served by the web server. You grant write permissions for your application in the Plesk File Manager via «Change Permissions» (application pool user, write and modify). Alternatively, enable «Additional write/modify permissions» in the domain’s «Hosting Settings», then the application may write anywhere in the document root.
  • Or create your own folder at the top level of your subscription in the Plesk File Manager, i.e. outside any document root, and grant the write permissions there via «Change Permissions». Via FTP this folder is only reachable with the main account of the subscription, not with additional FTP users restricted to a single domain.
  • Explicitly store the ASP.NET Core Data Protection keys in one of these folders (PersistKeysToFileSystem). Otherwise they are lost on a restart and logged-in users are logged out.

Secrets (e.g. API keys)

In the «.NET Core» tile you can store environment variables. They are not served publicly. Note: these settings end up in your application’s web.config. If you overwrite web.config when deploying a new version, they are gone. Values that must survive every deployment are better kept in a configuration file in the protected folder and read when the application starts.

Restarting or stopping the application

  • In the «.NET Core» tile with «Restart», or on the domain under «Dedicated IIS application pool» with the buttons to stop, start and recycle. Your other domains are not affected.
  • If you place a file named app_offline.htm in the document root, the application stops in a controlled way until you remove the file again. This is handy for updates or a consistent backup.
  • There is no command line access. However, via «Scheduled Tasks» in Plesk you can run your own programs, batch or PowerShell scripts on a schedule or immediately.

You can find more about the differences between the two hosting types in the article Difference between UNIX & Windows Hosting.

Related Post