In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to carry out the practice of KestrelServer + Shell in the. net Core production environment, the content of the article is of high quality, so the editor shares it for you to do a reference. I hope you will have some understanding of the relevant knowledge after reading this article.
1. The background describes the windwos service program deployed under the windwos server of the original project.
2. It has been revised to the service program under Linux Centos.
Environment description:
Server system: CentOS 7.0 +
Related tools: Xshel, Xftp
Server software:. Netcore,
1. Install CentOS
The test environment is installed by itself and prepared by the operation and maintenance team of the production environment company.
two。 Install .net Core SDK For Centos7
This place must have been bad on the Internet.
Reference: https://www.microsoft.com/net/core#linuxredhat
Select the specified system: select Centos here
Use the program developed by windwos in advance. Give .net Core 1.1
The following methods:
Option 1:
1.jexus + KestrelServer
Jexus:Jexus, namely Jexus Web Server, referred to as JWS, is an ASP.NET WEB server on the Linux platform. It is the core program for setting up ASP.NET WEB servers in non-Windows systems such as Linux, Unix, FreeBSD and other non-ASP.NET WEB systems. It is an optional scheme for enterprise ASP.NET cross-platform deployment. Compared with other WEB servers, Jexus not only has the iconic features of cross-platform ASP.NET servers, but also has a series of important functions and proprietary features at kernel level, such as security monitoring, intrusion detection, URL rewriting, no file routing and so on.
KestrelServer: Kestrel is a cross-platform ASP.NET Core web server based on libuv, and libuv is an asynchronous Imax O library across platforms. The ASP.NET Core template project uses Kestrel as the default web server.
Because this is a quasi-release Windwos service transformation program. So here is also a program similar to the service program.
1. Install jexus
Refer to the official website https://www.jexus.org/ here.
two。 After installing our release program, create your own folder in the corresponding directory.
The corresponding correlation here has all been installed. As shown in the picture, there are not too many pictures here because the company is strict with it.
Upload the program to
3. Configure the jexus profile.
4. Here, run Jexus's commands with slow passion. There was no response to check the results of the process.
A) Don't talk about the problem here, because Jexus requires root permission, because the permission assigned by the company does not have root permission. The restrictions on root permissions are serious. Here, I also communicated with Jexus's Da Niu Nei Liuyun and finally gave up using Jexus because of permission issues. (because Root permission must be used here in Jexus).
Option 2:
KestrelServer + Linux Shell programming mode
1.Shell script:
1.
The 2.Start.sh program is about to start calling the Start.sh script:
#! / bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Export PATH
Source / home/baseuser/.bash_profile
Nohup dotnet / home/baseuser/www/XX.XX.Service/XX.XX.Service.dll > nohup.out 2 > & 1 &
Call Stop.sh when the 2.Stop.sh program is about to stop
#! / bin/bash echo "begain kill server!" Ps-ef | grep XXX | grep-v "grep" | awk'{print "kill" $2}'| sh sleep 2 processnum= `ps-ef | grep XXX | grep-v "grep" | wc-l`if [$processnum-eq 0] then echo "kill Success!" Else echo "kill Failed!" Exit Fi
The 3.ServerStatus.sh Linux system timer checks the script regularly.
#! / bin/sh PATH= / usr/local/sbin: / usr/local/bin: / usr/sbin: / usr/bin: / sbin: / bin export PATH source / home/baseuser/ .bash _ profile echo 'look for server statu...' > > server_status.log processnum= `ps-ef | grep XXX | grep dotnet | wc-l`echo $processnum > > server_status.log if [$processnum-eq 0] then echo' server is shut down. Begain start server...' > > server_status.log echo "`source / Home/baseuser/www/XXX.XXX.Service/ start.sh` "echo 'server is starting' > > server_status.log else echo' server is normal...' > > server_status.log exit fi
4 configure system timer: crontab-e
1 * / 1 * cd / home/baseuser/www/XXX .XXX.Service &. / serverstatus .sh 2 > & 1
View related processes:
Or this is, you can kill the program process yourself, and the program will restart itself.
I only run the transformation program of the windwos service program here. If you want to run the Web application, just install Nginx and make a little configuration.
Net Core production environment on how to share the practice of KestrelServer + Shell here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.