asp.net core2.0 deploy centos7/linux system

1. Install dotnet sdk (add product key and yum source)
    Add key: sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc    
  添加yum源:sudo sh -c 'echo -e "[packages-microsoft-com-prod]\nname=packages-microsoft-com-prod \nbaseurl=https://packages.microsoft.com/yumrepos/microsoft-rhel7.3-prod\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/dotnetdev.repo'
    
    Start the installation: sudo yum install libunwind libicu
                     sudo yum install dotnet-sdk-2.1.104
    
As shown in the figure: go all the way to y    
The above dotnet sdk has been installed successfully! ! !

2. Check the version number:
    Command: dotnet --version
    
3. Create a new asp.net core webapi project and publish it on linux
    
       
   Create a new directory (aspnetcoreapi) in the linux system, and upload the published package to the linux system, as shown in the figure:
    
   
    Start the project, command: dotnet WebApplication1.dll, as shown in the figure:
    
    It shows that the startup was successful! ! ! !

4. Verify access
   
All visits were successful! ! !

*Note: The port 8080 was opened in advance by me, so it can be accessed.

Remaining problem: dotnet WebApplication1.dll is the port 8080 program that we temporarily opened. If SSH is turned off, port 8080 will stop, so we need to guard port 8080 and keep port 8080 in a normal state. Next In this article we will explain the guarding of the process.

   

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324541651&siteId=291194637