ASp.NET Core Centos7运行环境搭建

CentOS 7中运行搭建ASp.NET Core运行环境

1、环境

这里演示的环境是CentOS7,64bit

2、安装.NET Core SDK

sudo yum update

mkdir dn_cli

cd dn_clisudo yum install libunwind libicu

sudo yum install libunwind libicu

 

wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-dev-centos-x64.latest.tar.gz

tar -zxf dotnet-dev-centos-x64.latest.tar.gz

 

尝试执行命令:. /dotnet

提示错误:

Failed to load /root/dotnet/bin/libcoreclr.so, error: libunwind.so.8: cannot open shared object file: No such file or directory

解决方法:

yum install -y libunwind

 

尝试执行命令:. /dotnet

提示错误:

Failed to initialize CoreCLR, HRESULT: 0x80131500

解决方法:

yum install -y icu

尝试执行命令:. /dotnet --info,正常。


永久保存环境变量

找到/etc/profile文件(当用户第一次登录时,该文件被执行.),在最后面添加:

PATH=~/dn_cli:$PATH

export PATH

 

即时生效

source /etc/profile

 

3、下载cli-samples的HelloMvc例子 

 

cd ~
sudo yum -y install git

mkdir app

cd app

git clone https://github.com/aspnet/cli-samples.git

cd cli-samples

dotnet restore

cd HelloMvc

 

 需要显式指定HelloMvc的端口(即使指定的是5000端口),目前尝试过不加下面这段代码,发现默认的5000并不起作用

  

4、编译运行HelloMvc

将执行命令的当前目录定位到HelloMvc,并执行下面命令

dotnet run

打开浏览器 http://192.168.1.200:5600


 

posted @ 2018-02-26 11:17  shw0099  阅读(592)  评论(0编辑  收藏  举报