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


           ASP.NET Core负载均衡集群搭建(CentOS7+Nginx+Supervisor+Kestrel)
             asp.net core在linux运行下,一但命令行退出,程序将停止,而且asp.net core的监听以及负载问题将在这里说明
    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,否则负载不会成功
     
  • 相关阅读:
    安装cloudbase-init和qga批处理
    Windows添加自定义服务、批处理文件开机自启动方法
    Windows批处理:自动部署常用软件(静默安装)
    windows auto activate
    XML转译字符
    Leetcode908.Smallest Range I最小差值1
    Leetcode917.Reverse Only Letters仅仅反转字母
    Leetcode896.Monotonic Array单调数列
    Leetcode905.Sort Array By Parity按奇偶排序数组
    Leetcode892.Surface Area of 3D Shapes三维形体的表面积
  • 原文地址:https://www.cnblogs.com/tiaoshuidenong/p/8489585.html
Copyright © 2020-2023  润新知