Try to deploy an ASP. NET core application on Linux

Source: Internet
Author: User
Tags dotnet

Almost two months without contact with. NET, but every day with Linux, so want to try to run in Linux like. NET Applications.

    • Installing CentOS
    • Install. Net Core for Linux
    • Creating an ASP. NET Core Application
    • Installing Nginx
    • Configure Nginx Proxy

1, Installing the CentOS system

This online tutorial has filtered too much.

2. Install the cross-platform. NET Core SDK for CentOS7

    • sudo yum update
    • sudo yum install libunwind Libicu
    • sudo yum install dotnet-sdk-2.0.0

dotnet--info can confirm that the installation is successful

3. Create an ASP. NET Core Application

dotnet New Web

The default localhost setting is modified because external access to the virtual machine is required:

VI Program.cs

Add Useurls ("http://*:5000")

Publish and Test

dotnet Publish–c Release

Dotnet TestAspnetCore.dll

Focus: Setting up a firewall

sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-service=httpssudo firewall-cmd --permanent --zone=public --add-port=5000/tcp 
sudo firewall-cmd --reload

Virtual Machine External Access acknowledgement

4, install Nginx

sudo yum install epel-release

sudo yum install nginx

nginx –v 查看版本

Find the IP address of Linux and start the Nginx service

Virtual Machine External Access address

Note: If this page cannot be displayed, it is estimated that the firewall is not set.

5, configure Nginx Proxy

Nginx detailed settings to be continued

Try to deploy an ASP. NET core application on Linux

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.