Deploying ASP. NET Core using Jexus in a Linux environment

Source: Internet
Author: User
Tags dotnet

For information on how to add an ASP. NET core runtime environment to Linux, please refer to my previous article, this article will not repeat.

This article runs the following environment:




(1) Installing the standalone version of Jexus

This tutorial installs a standalone version of Jexus, and the standalone version of Jexus comes with mono, using Mono's stable version of 4.8. Install Jexus Use the command directly (need to execute under root):

Curl Https://jexus.org/release/x64/install.sh|sh

After successful installation, you will be prompted: OK, Jexus has been installed In/usr/jexus.

(2) Create an ASP. NET Core Application

We create an ASP. NET core MVC application in accordance with the official Microsoft ASP. NET core document, enter the following command

Cd/home//Navigate to home Directory

dotnet new Mvc-o Aspnetcoreapp//Create an MVC Web App CD in the current directory Aspnetcoreapp//navigate to Aspnetcoreapp Directory
Dotnet Run//running application


Note: Warn may be thrown here: "Unable to bind to http://localhost:5000 on the IPV6 loopback interface: ' Error-99 eaddrnotavail address n OT available ' ". Microsoft's Solution: https://github.com/aspnet/KestrelHttpServer/issues/2117
I try to use the aspnetcore_urls= "http://*:5000" dotnet run instead of the dotnet Run command to solve such problems in certain situations







Perfect solution: Add the specified port in the Program.cs class Buildwebhost method




Then execute the dotnet Run command to solve the problem perfectly.





(3) generating an ASP. NET Core Deployment file

We store the deployment files in the/var/www/aspnetcore directory

The command is as follows:

Mkdir-p/var/www/aspnetcore//New directory

cd/home/aspnetcoreapp///Locate under Project engineering

dotnet Publish-o/var/www/aspnetcore//Publish project project under the specified directory


The post-publication directory structure is as follows:



Because this is an empty project, we copy the view part of project engineering to the deployment directory







Let's test if the deployment works properly

Execute the following command

Dotnet/var/www/aspnetcore/aspnetcoreapp.dll





The test is OK, so we've finished our deployment structure and we'll run the project on Jexus later on.

(4) Deploying ASP. NET Core Project Engineering on Jexus

Jexus a profile for a Web site, because we need to create a new ASP. NET core Web site configuration file

Run the following command:

Cd/usr/jexus/siteconf//Navigate to the Jexus Web site configuration file directory

CP default Aspnetcore//copy Jexus provided by the template (who is handwriting this year?) )

VI Aspnetcore//Open our new Web site configuration file, and then modify the following (this is the command line modification, more trouble, patience is good)




OK, we have completed the profile of the ASP. NET Core website, the next step is to take the default template of the configuration file

Rm-rf/usr/jexus/siteconf/default//Kill the default configuration template

Then, let's start Jexus and look at the effect

If your jexus is already started, run the following command

SH/USR/JEXUS/JWS Restart//Restart Jexus

If your jexus is in a stopped state, run the following command

Sh/usr/jexus/jws Start//Startup Jexus

Bonus Stop Command

Sh/usr/jexus/jws Stop//Stop Jexus






Let's take a look at the effect.

Deploying ASP. NET Core using Jexus in a Linux environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.