你的位置:首页 > ASP.net教程

[ASP.net教程]asp.net core 在Ubuntu 运行


环境:

  • 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 417A0893sudo apt-get update

 

 2.安装

sudo apt-get install dotnet-dev-1.0.0-preview2-003121

 

  3.把程序上传到 /home/zulin/dotnet 目录

发布

 

 

 运行 还原 并运行

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