public void Initialize()
{
lock (_syncLock)
{
if (InStandbyMode)
{
if (!_warmupComplete)
{
if (!_webHostSettings.IsSelfHost)
{
HostingEnvironment.QueueBackgroundWorkItem((ct) => WarmUp(_webHostSettings));
}
else
{
Task.Run(() => WarmUp(_webHostSettings));
}
_warmupComplete = true;
}
}
else if (!_hostStarted)
{
if (!_webHostSettings.IsSelfHost)
{
HostingEnvironment.QueueBackgroundWorkItem((ct) => RunAndBlock(ct));
}
else
{
Task.Run(() => RunAndBlock());
}
_hostStarted = true;
}
}
}