fix: 修复数据库与SignalR无法连接的问题

This commit is contained in:
2025-08-15 13:02:56 +08:00
parent 6fa7fffa7f
commit a00cc84e48
20 changed files with 78 additions and 123 deletions

View File

@@ -95,8 +95,6 @@ public class HttpVideoStreamService : BackgroundService
{
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private readonly IServiceProvider _serviceProvider;
private HttpListener? _httpListener;
private readonly int _serverPort = 4321;
@@ -109,11 +107,6 @@ public class HttpVideoStreamService : BackgroundService
private readonly object _usbCameraLock = new object();
#endif
public HttpVideoStreamService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
private Optional<VideoStreamClient> TryGetClient(string boardId)
{
if (_clientDict.TryGetValue(boardId, out var client))
@@ -131,8 +124,7 @@ public class HttpVideoStreamService : BackgroundService
return client;
}
using var scope = _serviceProvider.CreateScope();
var userManager = scope.ServiceProvider.GetRequiredService<Database.UserManager>();
var userManager = new Database.UserManager();
var boardRet = userManager.GetBoardByID(Guid.Parse(boardId));
if (!boardRet.IsSuccessful || !boardRet.Value.HasValue)