public async void Run(IBackgroundTaskInstance taskInstance) { _deferral = taskInstance.GetDeferral(); SignalRRaspyberryPiClient.Initialize(); var webserver = new MyWebserver(); var thread = new Thread(() => webserver.Start()); thread.Start(); }
public void Run(IBackgroundTaskInstance taskInstance) { // // TODO: Insert code to perform background work // // If you start any asynchronous methods here, prevent the task // from closing prematurely by using BackgroundTaskDeferral as // described in http://aka.ms/backgroundtaskdeferral // _Deferral = taskInstance.GetDeferral(); var webserver = new MyWebserver(); await ThreadPool.RunAsync(workItem => { webserver.Start(); }); }