How Linux deploys the installation. Netcore Program

Source: Internet
Author: User
Tags dotnet ftp client cloud hosting

Preparation of the pieces:

Xshell: terminal emulator that supports SSH, SFTP, Telnet,rlogin, and serial. For Windows system remote connection to other different system servers;

Xftp:xftp is a flexible and lightweight sftp/ftp client user who needs to securely transfer files over the network. It provides powerful features such as direct editing of multiple panes, folder synchronization, their support, server-to-server transfer and third-party editor integration.

    Installation Tutorial: 51283990

Linux virtual machine or server one;

Begin

1. Upload. Netcore code to github or other code cloud hosting

If you can't upload to GitHub, you can also use Xftp to upload your code to a Linux server;

If you can pull the code through GIT, you can install Git on a Linux server, with no difference in how it is used and in Windows, install the command: Yum install git

2, use Xshell login Linux server, use tutorial reference 51283990

After entering, using Yum to install dependencies, I use the Netcore SDK version of 2.0.3, the server will also install the 2.0.3 version, before installing, be sure to first remove the other version of the Dotnet SDK, if you have more than one version of the SDK installed, Then in the deployment of the time will have some strange and strange problems;

Start installing dotnet sdk:https://www.microsoft.com/net/download/linux-package-manager/centos/ sdk-2.0.3, the actual opening is in English, I have been translated through the Chrome browser;

The dotnet--info command is available to confirm that the dotnet is complete

  

3, at this time, the Dotnet SDK has been installed, the code has been uploaded to the Linux server, and then, using the CD command, jump to the code directory, such as my code file is/aliyungit/***** directory, execute dotnet build-c Release The command packs the code and then publishes the code in the Execute dotnet publish-c release command, which is packaged to publish all Netcore works in the current directory, and the published file will be in the/project file/bin/release/ netcoreapp2.0, if your SDK is version 2.1, then netcoreapp2.0 will become netcoreapp2.1

  

If you are not viewing with xftp, you can also use the LS path or the ll path command to view all the files in the development directory, if LS or ll does not follow the path, it means to view all files in the current directory

4, using the CD into the netcoreapp2.0 directory, using the Dotnet project name,. dll, which is the description of the success of the operation, but we can not access the Web site, we need a web container for forwarding; But my running results and the diagram differ only by path.

The initial default port is 5000 if you want to change the port: 79525535

5, Installation nginx:1190000007116797

6, after installing Nginx, began to configure the location of Nginx, this does not say, I am not very clear, the connection is as follows:

Https://moonbingbing.gitbooks.io/openresty-best-practices/ngx/nginx_local_pcre.html
http://seanlook.com/2015/05/17/nginx-location-rewrite/

It's my project. Location configuration

  

7, after the configuration is complete, restart Nginx,service Nginx restart

8, repeat the 4th step operation;

9, at this time we have been able to access the external network deployment of the program, basically, the deployment is completed, but, if the Xshell closed, it is found that the deployment of the completion of the site is not accessible, in this, I understand that before the program is running only in the foreground run, and not into the background to run, Similar to the debug state in Visual Studio, I solved it through the Linux timed task (crontab command), which is basically to write a shell script file that determines whether the site program is running in the script file. If it is not running then enable (that is, perform the 4th step) and execute the Shell script at crontab time;

10, how to execute the Linux timing. Netcore Program

How Linux deploys the installation. Netcore Program

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.