使用windows控制臺(tái)調(diào)試服務(wù)的方法
將Program類的刪除,將里面的靜態(tài)類Main修改后放入服務(wù)類中:
partial class Server1 : ServiceBase
{
public Server1()
{
InitializeComponent();
}
/// <summary>
/// 應(yīng)用程序的主入口點(diǎn)。
/// </summary>
static void Main(string[] args)
{
Server1 sv = new Server1();
if (args.Length > 0)
{
sv.OnStart(args);
char c;
while ((c = Convert.ToChar(Console.Read())) != 'q')
if (c == 'g') GC.Collect();
sv.OnStop();
Console.ReadLine();
}
else
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
sv
};
ServiceBase.Run(ServicesToRun);
}
}
protected override void OnStart(string[] args)
{
}
protected override void OnStop()
{
}
}
相關(guān)文章
UnityShader使用圖像疊加實(shí)現(xiàn)運(yùn)動(dòng)模糊
這篇文章主要為大家詳細(xì)介紹了UnityShader使用圖像疊加實(shí)現(xiàn)運(yùn)動(dòng)模糊,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-02-02VS2019配置OpenCV4.1.0詳細(xì)教程與測(cè)試代碼(推薦)
這篇文章主要介紹了VS2019配置OpenCV4.1.0詳細(xì)教程與測(cè)試代碼,本文通過(guò)截圖實(shí)例代碼相結(jié)合給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-03-03C#實(shí)現(xiàn)的簡(jiǎn)單鏈表類實(shí)例
這篇文章主要介紹了C#實(shí)現(xiàn)的簡(jiǎn)單鏈表類,涉及C#針對(duì)鏈表的定義、實(shí)現(xiàn)及鏈表節(jié)點(diǎn)的增加、刪除與修改技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-08-08