ASP.NET applications are supported on Linux distributions. In this article, we will describe the installation of your .NET application on the Ubuntu distribution. To run the .NET application you have developed, you need to install the SDK package developed by Microsoft. Additionally, package manager downloads are only supported on x64 architecture. For ARM and other architectures, you can install it with Snap package manager or manually.
What is ASP.NET?
ASP.NET keeps the content that will appear in the static structure separate using the ASPX structure. It uses one of the “.net” languages when designing web pages and applications. ASP.Net is a very powerful web development platform that comes with .NET Framework. It enables not only HTML-based static pages but also interactive and renewable dynamic pages. E-commerce sites, news portals, corporate applications, and forum sites, which are among the most popular web applications of today, can be designed and managed with ASP.NET. More information: What is ASP.NET?
How to run ASP .NET applications on Ubuntu?
Step 1: Download .NET SDK on Ubuntu
First, you need to download the SDK package. To do this, paste the command on the terminal screen and complete the download:
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb rm packages-microsoft-prod.deb
Step 2: APT Package Update
Now, update the APT package manager by using the following command:
sudo apt update
Step 3: Install .NET SDK
For the application to work properly, you need to know which .NET version is and install that version. In this article, assuming that your application is developed with ASP.NET 5.0 version, this version will be installed:
sudo apt search dotnet-sdk
sudo apt install dotnet-sdk-5.0
Congratulations. You have successfully installed the .NET SDK package on your Linux distribution. Now it’s time to run the project.
Step 4: Make your application compatible with Linux
Navigate to the project’s folder via the terminal screen and run the following command. We set the name of the newly created folder as “out”. You can give any name you want.
dotnet publish -c Release -o out
Step 5: Run your application
Check the created project name in the “out” folder and then run your application using the following command. The Project.WebUI that appears in the folder is your project’s file (“Project” is your project’s name).
Congratulations! you have run your web application. You can control your web application at http://localhost:5000.