本文整理汇总了C#中HostControl.Stop方法的典型用法代码示例。如果您正苦于以下问题:C# HostControl.Stop方法的具体用法?C# HostControl.Stop怎么用?C# HostControl.Stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HostControl
的用法示例。
在下文中一共展示了HostControl.Stop方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
public bool Start(HostControl hostControl)
{
_log.Info("SampleService Starting...");
hostControl.RequestAdditionalTime(TimeSpan.FromSeconds(10));
Thread.Sleep(1000);
if(_throwOnStart)
{
_log.Info("Throwing as requested");
throw new InvalidOperationException("Throw on Start Requested");
}
ThreadPool.QueueUserWorkItem(x =>
{
Thread.Sleep(3000);
if(_throwUnhandled)
throw new InvalidOperationException("Throw Unhandled In Random Thread");
_log.Info("Requesting stop");
hostControl.Stop();
});
_log.Info("SampleService Started");
return true;
}
示例2: InteractiveModule
public InteractiveModule(HostControl hostControl)
{
StaticConfiguration.DisableErrorTraces = false;
Get["/version"] = _ =>
{
var updateManager = new UpdateManager(null);
return Response.AsJson(updateManager.CurrentlyInstalledVersion()?.ToString());
};
Post["/stop"] = _ =>
{
Task.Run(() => hostControl.Stop());
return HttpStatusCode.OK;
};
}
示例3: Start
public bool Start(HostControl hostControl)
{
Console.WriteLine("I exhibit bad behavior, but I started on command.");
ThreadPool.QueueUserWorkItem(x =>
{
Thread.Sleep(5000);
_log.Info("Stopping for no particular reason");
hostControl.Stop();
// _log.Info("Dying an ungraceful death");
//
// throw new InvalidOperationException("Oh, what a world.");
});
return true;
}
示例4: Start
public bool Start(HostControl hostControl)
{
_log.Info("SampleService Starting...");
hostControl.RequestAdditionalTime(TimeSpan.FromSeconds(10));
Thread.Sleep(1000);
ThreadPool.QueueUserWorkItem(x =>
{
Thread.Sleep(3000);
_log.Info("Requesting stop");
hostControl.Stop();
});
_log.Info("SampleService Started");
return true;
}
示例5: StopServiceForUpdating
private static void StopServiceForUpdating(HostControl control)
{
control.Stop();
}