分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 代码编程

asp.net core 二 Nginx Supervisor 负载,监听

发布时间:2023-09-06 01:44责任编辑:赖小花关键词:暂无标签
       ASP.NET Core负载均衡集群搭建(CentOS7+Nginx+Supervisor+Kestrel)
         asp.net core在linux运行下,一但命令行退出,程序将停止,而且asp.net core的监听以及负载问题将在这里说明
         参考连接:http://www.linuxidc.com/Linux/2016-11/136997.htm http://www.sohu.com/a/192683690_468635  https://www.cnblogs.com/ants/p/5732337.html
  1. 跨平台是ASP.NET Core一个显著的特性,而KestrelServer是目前微软推出了唯一一个能够真正跨平台的Server。KestrelServer利用一个名为KestrelEngine的网络引擎实现对请求的监听、接收和响应。KetrelServer之所以具有跨平台的特质,源于KestrelEngine是在一个名为libuv的跨平台网络库上开发
  2. Supervisor 实现监听的守护,保证监听在后台持续运行,避免命令行形式
  3. 配置Supervisor 为服务,开机启动,这样Supervisor监听的网站就可以开机自动启动
  4. Nginx 负载
          在asp.net core项目中,默认使用的是Kestrel Server ,进行请求监听       
 ?????public static IWebHost BuildWebHost(string[] args) => ???????????WebHost.CreateDefaultBuilder(args) ??//这句代码默认使用了Kestrel F12查看源,如下: ???????????????.UseUrls("http://*:8080";) ???????????????.UseStartup<Startup>() ?????????????????????????????.Build(); ???????// 备注: ???????// ????The following defaults are applied to the returned Microsoft.AspNetCore.Hosting.WebHostBuilder: ???????// ????use Kestrel as the web server, set the Microsoft.AspNetCore.Hosting.IHostingEnvironment.ContentRootPath ???????// ????to the result of System.IO.Directory.GetCurrentDirectory, load Microsoft.Extensions.Configuration.IConfiguration ???????// ????from ‘appsettings.json‘ and ‘appsettings.[Microsoft.AspNetCore.Hosting.IHostingEnvironment.EnvironmentName].json‘, ???????// ????load Microsoft.Extensions.Configuration.IConfiguration from User Secrets when ???????// ????Microsoft.AspNetCore.Hosting.IHostingEnvironment.EnvironmentName is ‘Development‘ ???????// ????using the entry assembly, load Microsoft.Extensions.Configuration.IConfiguration ???????// ????from environment variables, load Microsoft.Extensions.Configuration.IConfiguration ???????// ????from supplied command line args, configures the Microsoft.Extensions.Logging.ILoggerFactory ???????// ????to log to the console and debug output, enables IIS integration, enables the ???????// ????ability for frameworks to bind their options to their default configuration sections, ???????// ????and adds the developer exception page when Microsoft.AspNetCore.Hosting.IHostingEnvironment.EnvironmentName ???????// ????is ‘Development‘ ???????public static IWebHostBuilder CreateDefaultBuilder(string[] args);
       supervisor,主要负责进程服务的监听,在asp.net core以及supervisor安装部署配置完成之后,一个为Supervisor管理界面,一个为asp.net core网站,可通过Supervisor管理网站的启停,可管理多个网站
          
          
  安装Nginx 
 
 
 然后修改配置文件 /etc/nginx/con.d/default.conf,需要关闭Selinux,否则负载不会成功
 

asp.net core 二 Nginx Supervisor 负载,监听

原文地址:https://www.cnblogs.com/xiangchangdong/p/8489585.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved