public static void ConfigureKestrel(WebHostBuilderContext context, KestrelServerOptions options) { var rootPath = context.Configuration.GetSection("SMEIoT")?.GetValue <string>("SystemFilesRoot"); if (rootPath == null) { return; } var provider = new PhysicalFileProvider(rootPath); var unixSocketFileInfo = provider.GetFileInfo("smeiot.auth.broker"); if (unixSocketFileInfo.Exists) { File.Delete(unixSocketFileInfo.PhysicalPath); } if (context.Configuration.GetSection("SMEIoT")?.GetValue <bool>("UseMosquittoBackgroundClient") == true) { options.ListenUnixSocket(unixSocketFileInfo.PhysicalPath, builder => { builder.Protocols = HttpProtocols.None; builder.UseConnectionHandler <MosquittoBrokerAuthHandler>(); }); } }