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