diff --git a/Frameworks/MQTTnet.NetStandard/Server/MqttServer.cs b/Frameworks/MQTTnet.NetStandard/Server/MqttServer.cs
index b32869d..0324134 100644
--- a/Frameworks/MQTTnet.NetStandard/Server/MqttServer.cs
+++ b/Frameworks/MQTTnet.NetStandard/Server/MqttServer.cs
@@ -156,9 +156,11 @@ namespace MQTTnet.Server
private void OnClientAccepted(object sender, MqttServerAdapterClientAcceptedEventArgs eventArgs)
{
- eventArgs.SessionTask = Task.Run(
+ eventArgs.SessionTask = Task.Factory.StartNew(
() => _clientSessionsManager.RunSessionAsync(eventArgs.Client, _cancellationTokenSource.Token),
- _cancellationTokenSource.Token);
+ _cancellationTokenSource.Token,
+ TaskCreationOptions.LongRunning,
+ TaskScheduler.Current);
}
}
}
diff --git a/Frameworks/MQTTnet.Netstandard/MQTTnet.NetStandard.csproj b/Frameworks/MQTTnet.Netstandard/MQTTnet.NetStandard.csproj
index fc1e41a..8364378 100644
--- a/Frameworks/MQTTnet.Netstandard/MQTTnet.NetStandard.csproj
+++ b/Frameworks/MQTTnet.Netstandard/MQTTnet.NetStandard.csproj
@@ -22,7 +22,7 @@
false
UAP,Version=v10.0
UAP
- 10.0.16299.0
+ 10.0.17134.0
10.0.10240.0
.NETCore
v5.0
@@ -56,7 +56,7 @@
-
+