我有一个c#程序在从VS调试/运行时运行正常。当它在任务调度程序上运行时,它会在我的代码中的某个点停止,然后运行并运行。我可以根据我的日志看到这一点。
这是我的代码:
static class Program
{
static void Main()
{
try
{
Log.WriteLog("Email Sync invoking...");
// task scheduler stops here
foreach (EmailAccount account in EmailAccount.Get())
{
Log.WriteLog("Syncing email account " + account.Username);
EmailAccount.Sync(12, account.Username);
}
Log.WriteLog("Email Sync completed.");
}
catch (Exception ex)
{
Log.WriteError(ex);
}
}
}
为什么会发生这种情况?