红联Linux门户
Linux帮助

asp.net core在Ubuntu运行

发布时间:2016-07-02 15:03:19来源:linux网站作者:Julian.Huang
环境:
Ubuntu 16.04
dotnet-dev-1.0.0-preview2-003121
Visual Studio 2015 update 3 
 
Ubuntu 安装.net core 参考:https://www.microsoft.com/net/core#ubuntu
 
1.添加源
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
sudo apt-get update
 
2.安装
sudo apt-get install dotnet-dev-1.0.0-preview2-003121
 
3.把程序上传到 /home/zulin/dotnet 目录
asp.net core在Ubuntu运行
asp.net core在Ubuntu运行
发布
asp.net core在Ubuntu运行
运行 还原 并运行
dotnet coredemo.dll
 
4.配置nginx 代理 
#安装
sudo apt-get install nginx
#配置
sudo nano /etc/nginx/sites-available/default
#添加到后尾
server {
# Port and domain
listen 8080;
server_name aspnet.local;
# Path to the wwwroot folder
root /home/zulin/dotnet/wwwroot;
# Pass requests to Kestrel
location / {
proxy_pass http://127.0.0.1:5000;
proxy_set_header Connection "";
proxy_http_version 1.1;
}
}
#重启服务
sudo service nginx restart
 
现在可以在浏览器上查看了:
http://xxx.xxx.xxx.xxx:8080
 
本文永久更新地址:http://www.linuxdiyf.com/linux/21998.html