ASP.NET Core 学习笔记(环境配置与搭建)

一、环境安装

1、下载网址https://www.microsoft.com/net/download/windows/build, 可选择三个 版本

2、VS 2017 安装

3、WINDOWS:IIS 启用

  安装.net core 托管模块 DotNetCore.1.0.4_1.1.1-WindowsHosting.exe

安装完成

4、发布浏览

扫描二维码关注公众号,回复: 21187 查看本文章

 5、VMware+CentOS+putty+Nginx

  Nginx安装:https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-centos-7

       开启Nginx:sudo systemctl start nginx

6、centos 安装.net  core sdk

https://www.microsoft.com/net/learn/get-started/linux/centos

(注意依赖关系:会出错:Failed to resolve library symbol hostfxr_main_startupinfo, error: /usr/share/dotnet/host/fxr/2.0.5/libhostfxr.so: undefined symbol: hostfxr_main_startupinfo 2.1.4

解决方法:https://stackoverflow.com/questions/49810487/failed-to-resolve-library-symbol-hostfxr-main-startupinfo-on-amazon-linux-2-ami/49812045#49812045)

7、FileZilla +发布 vs2017 生成项目

    运行项目: dotnet HelloVS.dll

    检测项目成功运行:curl http://localhost:5000

 8、Nginx 80端口 映射到运行项目的5000端口

  cd etc/nginx 

  nginx.conf 为配置文件 (包含conf 的其他文件,必须注释默认80 端口配置)

  直接输入 cd conf.d

  在该路径下创建 自己的配置文件: touch netcore.conf

server {
    listen 80;
    location / {
        proxy_pass http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection keep-alive;
        proxy_set_header Host $http_host;
        proxy_cache_bypass $http_upgrade;
    }
}

  端口映射后重启 nginx 

  systemctl restart nginx 或者 nginx -s reload

9、 在浏览器端输入IP地址

  出现502 badgetway 错误排查 1、站点是否启动 2、配置文件是否错误 3、Nginx是否重启

  均无问题 参考 setsebool -P httpd_can_network_connect 1:https://stackoverflow.com/questions/23948527/13-permission-denied-while-connecting-to-upstreamnginx

       

猜你喜欢

转载自www.cnblogs.com/caolingyi/p/8821206.html