MQTT实战3 - NetCore 2.0 + MQTTnet 3.0.9 实现mqtt通信


MQTT实战1 - 使用Apache Apollo代理服务器实现mqtt通信

MQTT实战2 - 使用MQTTnet实现mqtt通信

MQTT实战3 - NetCore 2.0 + MQTTnet 3.0.9 实现mqtt通信

 

using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;

namespace MqttNetAgent
{
    public class Program
    {
        // =====================================================================
        // 运行
        // NetCore 2.0 + MQTTnet 3.0.9 && MQTTnet.AspNetCore 3.0.9
        // MqttNetAgent 启动运行
        // MqttClient 使用端口61615
        // web        使用端口5000
        // username,password为空
        // =====================================================================
        // 发布
        // cmd
        // f:
        // cd F:\iot\IoTPlatform\MqttNetAgent\MqttNetAgent\bin\Debug\netcoreapp2.0
        // dotnet MqttNetAgent.dll
        // =====================================================================
        public static void Main(string[] args)
        {
            BuildWebHost(args).Run();
        }

        public static IWebHost BuildWebHost(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseStartup<Startup>()
                //.UseUrls("http://192.168.1.80:5000") // 发布地址
                .UseUrls("http://127.0.0.1:5000") // 发布地址
                .Build();
    }
}

  

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM