预编译命令 #if DEBUG

在控制台程序根据预编译命令:

http://www.askapache.com/windows/advanced-batch-scripting.html

namespace SXGYCarTransfrom.Handle
{
class Program
{
static void Main(string[] args)
{
#if DEBUG
RunAsConsole();
#else
RunAsServer();
#endif
} /// <summary>
/// DEBUG 时跑的为控制台程序
/// </summary>
private static void RunAsConsole()
{
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(TaskStart.CurrentDomain_UnhandledException);
var _task = new TaskStart();
while (true)
{
// 输出日志
Console.ReadLine();
}
} /// <summary>
/// Release 时启动的为服务
/// </summary>
private static void RunAsServer()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new TransService()
};
ServiceBase.Run(ServicesToRun);
}
}
}
上一篇:Redis必须注意的慢查询问题


下一篇:centos6.4安装Vmware exsi CLI