mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-15 00:15:15 +08:00
1889 no service for type mqttnetservermqttserver has been registered (#1892)
* Add missing service to service collection * Update ReleaseNotes.md * Restore service registrations
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
* [Server] Added new events for delivered and dropped messages (#1866, thanks to @kallayj).
|
||||
* [Server] The server will no longer treat a client which is receiving a large payload as alive. The packet must be received completely within the keep alive boundaries (BREAKING CHANGE!, #1883).
|
||||
* [Server] Fixed "service not registered" exception in ASP.NET integration (#1889).
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using MQTTnet.Adapter;
|
||||
using MQTTnet.Diagnostics;
|
||||
using MQTTnet.Implementations;
|
||||
@@ -58,7 +59,8 @@ namespace MQTTnet.AspNetCore
|
||||
services.TryAddSingleton(new MqttFactory());
|
||||
|
||||
services.AddSingleton<MqttHostedServer>();
|
||||
services.AddHostedService<MqttHostedServer>();
|
||||
services.AddSingleton<IHostedService>(s => s.GetService<MqttHostedServer>());
|
||||
services.AddSingleton<MqttServer>(s => s.GetService<MqttHostedServer>());
|
||||
}
|
||||
|
||||
public static IServiceCollection AddHostedMqttServerWithServices(this IServiceCollection services, Action<AspNetMqttServerOptionsBuilder> configure)
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace MQTTnet.Adapter
|
||||
Func<IMqttChannelAdapter, Task> ClientHandler { get; set; }
|
||||
|
||||
Task StartAsync(MqttServerOptions options, IMqttNetLogger logger);
|
||||
|
||||
Task StopAsync();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user