Deploy on Linux server Net core method tutorial

Server is a high-performance computer. As a node of the network, it stores and processes 80% of the data and information on the network. Therefore, it is also known as the soul of the network. For beginners, it will be Net core is very difficult to deploy on Linux server. In order to help you solve the difficulties, today I want to share with you how to deploy on Linux server Net Core?

Deployment NET Core

Since I don't have a MacOS device available, I'll just use Linux (server) as a demonstration. The server I demonstrated is the centos7 operating system.

Connect SSH to the server and install Net core dependencies:

Then get it from Microsoft official Net core main program:

If your server can't access this address correctly, you may need to manually access the following address. After downloading, pass it to the server in any way and name it dotnet tar. gz。

Execute the instruction to unzip the component to the specified location:

Create a link to directly reference the dotnet directive in any path:

So far Net core framework should be built on your server.

3. Try to deploy an ASP Net service program

On the local computer, modify the visual studio features to ensure that this item is installed:

Start visual studio and create a new ASP Net core project:

Select the type of web application. We don't modify the example too much, just to demonstrate ASP Net runs on Net core. Open program in Project Explorer CS, still familiar c# Code:

In order to run normally, we slightly modify the code to make the object initializer of host look like this:

Save the project and upload the whole solution to the server. Connect the server again, navigate to the directory where you store the project files, and execute the instructions:

The order commands Net core restores the package referenced by this project and waits patiently for the instructions to be executed.

Next, execute the command:

This instruction will make Net core compile and run this project. The console has no error message and produces similar output to your ASP Net core application should run correctly:

Try to access the IP address (or domain name) of your server on any device. If the default page can be loaded correctly, your Net core environment is deployed:

This Net framework is just Net standard, not necessarily 100% compatible with a complex ASP Net service program. But with this framework, you can switch the server to Linux system, but still use ASP Net as the specific implementation method of service program. You don't have to configure a Linux working environment to debug service programs running on Linux - because Net core can also run on windows. Visual studio itself supports using IIS express to debug an ASP locally Net core application.

Supplement: server introduction

Servers, also known as servers, are devices that provide computing services. Since the server needs to respond to service requests and process them, generally speaking, the server should have the ability to undertake services and ensure services.

The composition of the server includes processor, hard disk, memory, system bus, etc., which is similar to the general computer architecture. However, due to the need to provide highly reliable services, it requires high processing capacity, stability, reliability, security, scalability, manageability and so on.

In the network environment, according to the different types of services provided by the server, it is divided into file server, database server, application server, web server, etc.

Related reading: what are the server FAQs

  1. System blue screen, frequent crash, restart, slow response

The of the server is very similar to our ordinary computer, whether it is hardware structure or running system. Therefore, just like our computers, they may be infected with viruses, crash, blue screen, restart and other failures due to system vulnerabilities, software conflicts and hardware failures, and slow response due to too much garbage cache information.

  2. The remote desktop connection exceeds the maximum number of connections

Since the server allows 2 connections by default, if you forget to log off after logging in and directly close the remote desktop, the server recognizes that the login is still on the server side. In this case, the most common is to restart the server. However, if it is the peak period, the loss caused by restarting the server is obvious. At this time, you can use the mstsc / console command to forcibly log in. Open the "run" box and type "mstsc / V: xxx.xxx.xxx.xxx (server IP) / console" to forcibly log in to the remote desktop.

  3. How to clean up files that cannot be deleted

In this case, it may be that the file is still running. You can restart and delete it, or run CMD, enter the name of the folder arrtib-a-s-h-r you want to delete, and finally enter the name of the folder del wants to delete. It cannot be recovered after running this command. Please use it with caution.

  4. Hidden trouble of system port

For the server, the first thing is to ensure stability and security. Therefore, we only need to ensure the most basic functions of the server, just like the sound card is prohibited by default. We don't need too many functions and port support. For example, some unnecessary and high-risk ports can be blocked. For some necessary and risky ports, such as ports 3389 and 80, we can set them as non-special secret ports by modifying the registry, so that the security hidden dangers of server ports no longer exist.