Abp vNext 集成 MQTT


目录
  • Abp vNext 集成 MQTT
    • Broker
      • ApsNet Core 集成 MQTT
        • 引用包
        • 添加服务
        • 添加 MQTT Endpoint
        • 设置 MQTT监听端口
        • https://localhost:44359)是无法访问 Api的。

          原因:

          通过 ConfigureKestrel() 方法在 Kestrel 上设置的Http和Https 监听端口后,其它地方设置(例如:在launchSettings.json 文件)的监听方式会被覆盖而失效!

          而我们又没有在ConfigureKestrel()的方法中重新设置Http和Https 的监听端口。
          在日志中也能看到提示警告:

          [11:17:46 WRN] Overriding address(es) 'https://localhost:44359'. Binding to endpoints defined via IConfiguration and/or UseKestrel() instead.
          

          如何修复呢?

          可通过修改配置文件appsettings.json来设置Http和Https的监听端口,具体操作如下:

          在配置文件appsettings.json中添加如下 Kestrel 配置节点:

          {
            "Kestrel": {
              "Endpoints": {
                "Http": {
                  "Url": "http://localhost:7059",
                  "Protocols": "Http1AndHttp2" 
                },
                "Https": {
                  "Url": "https://localhost:44359",
                  "Protocols": "Http1AndHttp2" 
                },
              }
            }
            // .....   
          }
          

          这样就通过配置文件的方式为Kestrel 设置了Http和Https的监听端口