将program类的删除,将里面的静态类main修改后放入服务类中:
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()
{
}
}
如对本文有疑问, 点击进行留言回复!!
使用Visual Studio2019创建C#项目(窗体应用程序、控制台应用程序、Web应用程序)
C#实现获取本地内网(局域网)和外网(公网)IP地址的方法分析
浅谈Visual Studio 2019 Vue项目的目录结构
网友评论