CENTOS7 build. Netcore Operating Environment

Source: Internet
Author: User

Introduction to the development environment

1. Operating system: Windows Server R2 Enterprise

2.ide:visualstudio2017

3..Net Core 2.0 SDK

This article assumes that you have met the above criteria. The. NET core2.0 project is created and published successfully.

Download the. Net Core 2.0 SDK

1. Prepare a machine equipped with CENTOS7, IP set to: 192.168.1.10

2. Download the. Net Core 2.0 SDK for CENTOS7

: Https://www.microsoft.com/net/download/linux

3. Copy to Centos7

Enter CENTOS7 to create the/soft directory:

[Email protected] soft]# Mkdir/soft

Copy the downloaded dotnet-sdk-2.0.0-linux-x64.tar.gz to the/soft directory via the WINSCP tool

Installing the. Net Core 2.0 SDK

1. Unzip:

[Email protected] ~]# Cd/soft

[Email protected] soft]# mkdir-p $HOME/dotnet && tar zxf dotnet-sdk-2.0.0-linux-x64.tar.gz-c $HOME/dotnet

This order is officially provided by Microsoft, extracted to:/root/dotnet.

2. Edit the profile:

[Email protected] soft]# Vi/etc/profile

Copy "Export path= $PATH: $HOME/dotnet" to the bottom of the file, save and exit.

Refresh Profile

[Email protected] soft]# Source/etc/profile

3. View Dotnet Version:

[Email protected] soft]# dotnet–version

4. The finished thing, reported abnormal:

Failed to load, Error:libunwind.so.8:cannot open shared object file:no such file or directory

Failed to bind-CoreCLR at '/root/dotnet/shared/microsoft.netcore.app/2.0.0/libcoreclr.so '

Not afraid, because we did not install Libunwind, as long as the installation can be, execute the following command:

[email protected] soft]# Yum install Libunwind

5. Execute the above command again:

[Email protected] soft]# dotnet–version

6. Also reported exception:

Failfast:couldn ' t find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to True if you want to run with no globalization support.

Can we have a good play? This prompt tells us that the ICU is not installed and executes the following command:

[[email protected] soft]# Yum install ICU

7. Execute the above command again:

[Email protected] soft]# dotnet--version

This indicates that the installation was successful.

Running the ASP. NET Core Program

1. Modifying the Buildwebhost method of Program.cs

Obviously, add this line of code, we can not only use 80 port access, 5000 port can also.

2. Open port

You also need to turn on 80 ports and 5000 ports for external machines to be accessible.

[Email protected] coredemo]# firewall-cmd--zone=public--add-port=80/tcp--permanent

[Email protected] coredemo]# firewall-cmd--zone=public--add-port=5000/tcp--permanent

Restarting the firewall

[Email protected] coredemo]# Firewall-cmd–reload

3. Publish the ASP. NET core program and copy it to the Centos7/soft directory using the WinSCP tool

The project name I built is called: Coredemo, so what you see here is: Coredemo.

[Email protected] soft]# cd/soft/coredemo/

[Email protected] coredemo]# dotnet Coredemo.dll

warn:microsoft.aspnetcore.dataprotection.keymanagement.xmlkeymanager[]      No XML encryptor Configured. Key {6dfc9509-6201in/soft/coredemonow listening on:http://  192.168.1.10:5000nowlistening on:http://192.168.1.10:80Application Started. Press Ctrl+c to shut down.

This prompt indicates that our ASP. NET Core program is working properly.

4. Access

Enter the address on the browser of another machine: both http://192.168.1.10 and http://192.168.1.10:5000/can access

All right, it's done.

CENTOS7 build. Netcore Operating Environment

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.