• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Run .Net Frameworks 4 on Linux

whyicantgetin

New Pleskian
Server operating system version
Ubuntu 22.04.4
Plesk version and microupdate number
18.0.61
Hello All,

I need your advice. I have a web application built with .NET Framework 4, and my Plesk server is running on Linux. I want to run this application on Plesk.
Could I create a Windows VM using the Docker extension and run the application on Linux?
Do you know how to achieve this? Will the performance be optimal?
Additionally, if I have more than one .NET Framework 4 application, should I create a separate Windows VM for each application?

Thanks
 
Another option would be the following:

Step 1: Install .NET Runtime on the Server
Connect to Your Server:
Use SSH to connect to your Linux server.

Install Required Dependencies:
Ensure your server has the required dependencies for .NET. You can use the following commands for Debian/Ubuntu:


sudo apt-get update
sudo apt-get install -y wget apt-transport-https



Add Microsoft Package Repository:
Add the Microsoft package repository to your server:


wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb



Install .NET Runtime:
Install the .NET runtime:


sudo apt-get update
sudo apt-get install -y dotnet-runtime-6.0

Adjust the version number (6.0 in this example) according to your application's requirements.

Step 2: Deploy Your .NET Application

Publish Your Application:
Publish your .NET application for Linux. Use the following command in your development environment:


dotnet publish -c Release -r linux-x64 --self-contained
This command generates a self-contained deployment in the bin/Release/net6.0/linux-x64/publish directory.

Upload Your Application:
Upload the published application files to your Plesk server using SFTP or a file manager.

Place Application Files:
Place the application files in the appropriate directory on your server, usually under /var/www/vhosts/yourdomain.com/httpdocs.

Step 3: Configure the Application

Create a Service File:
Create a systemd service file to manage your application.
Create a new file /etc/systemd/system/yourapp.service with the following content:


[Unit]
Description=Your .NET Application
After=network.target

[Service]
WorkingDirectory=/var/www/vhosts/yourdomain.com/httpdocs
ExecStart=/var/www/vhosts/yourdomain.com/httpdocs/yourapp
Restart=always
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=yourapp
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy=multi-user.target
Adjust the WorkingDirectory and ExecStart paths according to your application's location.

Reload Systemd and Start the Service:
Reload systemd to recognize the new service and start it:


sudo systemctl daemon-reload
sudo systemctl start yourapp.service
sudo systemctl enable yourapp.service

Step 4: Configure Plesk
Proxy Pass Configuration:
In Plesk, set up a proxy pass to forward requests to your .NET application. Go to your domain's settings, and add the following in the Apache & nginx Settings:

For Apache:


ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/


For nginx:

location / {
proxy_pass http://127.0.0.1:5000
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
Adjust the port number (5000 in this example) if your application listens on a different port.

Step 5: Test Your Application
Access Your Application:
Open your web browser and navigate to your domain to verify that the application is running correctly.
 
Hello Afuego,

.NET toolkit extension is not covering the .Net Framework of older version of .Net.
In fact .Net Framework 4 is not .Net Core. On this application, I didnt need to publish to folder because the file is using .aspx .
I try one of my application using .Net Core 8 is working well. Anyways, I have try run .Net Framework 4 and cannot run haha.

Thank you for answering
 
Back
Top