如何在IIS上部署net系统(安装iis参考上一篇)

1.对后端项目打包,我使用的时rider

 

 

2.打包前端  npm run build

3.在iis上部署  网站-添加网站

4.选择之前打包的后端文件,设置端口

 

5.安装对应net环境插件:主要是runtime和sdk插件以及dotnet-hosting-2.2.0-win,具体版本看自己项目的对应版本

 这是缺少插件的报错

 

6.安装好插件后启动下iis后端

 

 

 后端启动成功

7.配置nginx下的nginx.conf


#user  nobody;
worker_processes  1;#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;#pid        logs/nginx.pid;events {worker_connections  1024;
}http {client_max_body_size 300m;include       mime.types;default_type  application/octet-stream;#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '#                  '$status $body_bytes_sent "$http_referer" '#                  '"$http_user_agent" "$http_x_forwarded_for"';#access_log  logs/access.log  main;sendfile        on;#tcp_nopush     on;#keepalive_timeout  0;keepalive_timeout  65;#gzip  on;server {listen       8030;server_name  localhost;#charset koi8-r;#access_log  logs/host.access.log  main;gzip on;gzip_min_length 1k;gzip_comp_level 9;gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;gzip_vary on;gzip_disable "MSIE [1-6]\.";gzip_buffers 32 4k;gzip_static on;location / {root   D:\deployment\WithinHospReviewFE; #对应前端地址index  index.html index.htm;# 用于配合 browserHistory使用 try_files $uri $uri/ /index.html;}location ~ /api/ {rewrite  ^.+apis/?(.*)$ /$1 break;include  uwsgi_params;proxy_connect_timeout 600s;proxy_send_timeout 600s;proxy_read_timeout 600s;proxy_pass  http://192.168.2.4:7070; #对应发布之后部署到iis的后端api地址}#error_page  404              /404.html;# redirect server error pages to the static page /50x.html#error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}# proxy the PHP scripts to Apache listening on 127.0.0.1:8091##location ~ \.php$ {#    proxy_pass   http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000##location ~ \.php$ {#    root           html;#    fastcgi_pass   127.0.0.1:9000;#    fastcgi_index  index.php;#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;#    include        fastcgi_params;#}# deny access to .htaccess files, if Apache's document root# concurs with nginx's one##location ~ /\.ht {#    deny  all;#}}# another virtual host using mix of IP-, name-, and port-based configuration##server {#    listen       8000;#    listen       somename:8080;#    server_name  somename  alias  another.alias;#    location / {#        root   html;#        index  index.html index.htm;#    }#}# HTTPS server##server {#    listen       443 ssl;#    server_name  localhost;#    ssl_certificate      cert.pem;#    ssl_certificate_key  cert.key;#    ssl_session_cache    shared:SSL:1m;#    ssl_session_timeout  5m;#    ssl_ciphers  HIGH:!aNULL:!MD5;#    ssl_prefer_server_ciphers  on;#    location / {#        root   html;#        index  index.html index.htm;#    }#}}

配置好后,对外的访问ip地址即为:https://blog.csdn.net/qq_46636081/article/details/149015799?spm=1001.2014 

8.常见问题:

8.1.缺少net核心插件

 8.2.nginx配置错误,比如我之前在nginx配置时,配置前端项目路径时有中文目录,需要将中文目录修改为英文目录

8.3.nginx启动失败,nginx启动后可以自己在任务管理器中查看下,是否启动成功,有时启动后nginx会秒挂掉

 

9.IIS安装

https://blog.csdn.net/qq_46636081/article/details/149015799?spm=1001.2014