无法运行 MQTT Broker 服务

问题描述 投票:0回答:1

首先,当我设置

listener 1883
allow_anonymous true

在 mosquitto.conf 中, 我可以通过 CMD 中的“net start mosquitto”运行 mqtt 代理服务,并且当我检查服务时它可以工作。但当我把它改成

listener 1883
allow_anonymous false
password_file C:\Program Files\mosquitto\passwd

我无法再运行 mqtt 代理,尽管在 CMD 中它已成功运行。当我尝试直接在servicecs上运行mqtt代理时,它说

The Mosquitto Broker service on Local Storage started and then stopped. Some services stop automatically if they are not in use by other services or programs

我尝试重新安装很多次,但仍然出现此错误。

mqtt mosquitto
1个回答
0
投票

您始终可以通过从命令行显式运行配置文件来测试配置文件

mosquitto -c c:\full\path\to\mosquitto.conf

您应该先停止该服务,以免与所使用的端口发生冲突。

在这种情况下,它可能会打印一条有关无法找到密码文件的错误,因为它的路径中有空格。您应该能够通过将其用引号括起来来解决此问题:

listener 1883
allow_anonymous false
password_file "C:\Program Files\mosquitto\passwd"
© www.soinside.com 2019 - 2024. All rights reserved.