我有一个用于移动设备的嵌入服务器,有时可能会崩溃。我需要始终让服务器处于活动状态。现在的问题是我看不到异步时如何重新启动服务器:
let startServer(rootPath) =
let cf = serverConfig rootPath
printfn "%A" cf
startWebServerAsync cf app
|> snd
|> Async.StartAsTask
type App() =
inherit Application()
let mutable task:System.Threading.Tasks.Task = null
do
let t = startServer(...)
task <- t //The task is hold here to avoid it being GC..
如何清理所有并重新启动服务器?