• 安装IIs对 netcore 的支持

  https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/aspnet-core-module?tabs=aspnetcore2x

  https://dotnet.microsoft.com/download/dotnet-core hosting下载地址

  https://www.cnblogs.com/a-dou/p/6685582.html

1.安装hosting 2. 添加应用程序池使用无托管代码。 3.添加新网站使用新添加的应用程序池

  • 安装VS2017节省空间办法

  mklink /D C:\ProgramData\Microsoft\VisualStudio\Packages  "D:\Packages"

  • Linx环境下配置nginx

      sudo yum install epel-release ----添加nginx repository
    
      sudo yum install nginx ---添加nginx
    
      sudo systemctl start nginx -start nginx
    
      sudo firewall-cmd --permanent --zone-public --add service-http//打开防火墙
    
      sudo firewall-cmd --permanent --zone-public --add service-https//打开防火墙
    
      sudo firewall-cmd --reload
    
      /sbin/iptables -I INPUT -p tcp --dport  -j ACCEPT 打开80端口
  • 配置 .net core sdk 于liunx  https://www.microsoft.com/net/learn/get-started/linux/centos

    添加.NET相关   sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
    
    sudo sh -c 'echo -e "[packages-microsoft-com-prod]\nname=packages-microsoft-com-prod \nbaseurl= https://packages.microsoft.com/yumrepos/microsoft-rhel7.3-prod\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/dotnetdev.repo'
    
    安装.NET SDK
    sudo yum -y update
    sudo yum -y install libunwind libicu
    sudo yum -y install dotnet-sdk-2.0.
  • Linux启动网站  首先转到项目文件夹路径 然后运行    dotnet   projectname.dll 启动网站
  • curl http://localhost:5000 测试是否启动(默认配置到5000端口下)

  • 将80端口映射到5000 的nginx节点配置
    server {
    listen 80:
    location / {
    proxy_pass http://localhost:5000;
    root /home/netcore
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection keep-alive;
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
    }
    }
  • 重启nginx:nginx -s relaod
 
05-28 13:44