Trying to get over this bump to begin getting my Home Automation projects going.
@code {
protected override void OnInitialized()
{
MQTTService.MQTTServer_Start();
}
async void MQTTServer_Start()
{
var options = new MqttServerOptionsBuilder().WithDefaultEndpoint().WithDefaultEndpointPort(1111);
var server = new MqttFactory().CreateMqttServer(options.Build());
server.InterceptingPublishAsync += Server_InterceptingPublishAsync;
await server.StartAsync();
Task Server_InterceptingPublishAsync(InterceptingPublishEventArgs arg)
{
var payload = arg.ApplicationMessage?.Payload == null ? null : Encoding.UTF8.GetString(arg.ApplicationMessage?.Payload);
Debug.WriteLine(arg.ClientId);
return Task.CompletedTask;
}
}
}
Anyone has any idea why it works from VS but fails from IIS? Any good techniques out there I could follow to get over that bump?
Fixed by creating both an inbound and outbound Firewall rule for the Port allowing access. However this doesn't explain it is not needed when the same code and web site are run by Visual Studio compared to when it's running in IIS; on the same machine. I'll consider posting that as a separate question on here.