从TaskScheduler运行时为什么会出现Win32Exception?

时间:2015-06-18 10:34:24

标签: c# scheduled-tasks win32exception

只有从TaskScheduler运行时才会出现异常:

static class Program
{
    [STAThread]
    static void Main(string[] args)
     {
        Application.Run(new Master());
     }
}

public partial class Master : Form
{

   public Master()  //  EXCEPTION OCCURS HERE
   {

   }
}

任务计划程序:

Run whether user logged in or not : Checked 
Run with highest privileges : Checked

System.ComponentModel.Win32Exception未处理   的HResult = -2147467259   消息=找不到指定的过程   来源= System.Windows.Forms的   错误码= -2147467259   NativeErrorCode = 127   堆栈跟踪:        在System.Windows.Forms.NativeWindow.WindowClass.RegisterClass()        在System.Windows.Forms.NativeWindow.WindowClass.Create(String className,Int32 classStyle)        在System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)        在System.Windows.Forms.Control.CreateHandle()        在System.Windows.Forms.Application.MarshalingControl..ctor()        在System.Windows.Forms.Application.ThreadContext.get_MarshalingControl()        在System.Windows.Forms.WindowsFormsSynchronizationContext..ctor()        在System.Windows.Forms.WindowsFormsSynchronizationContext.InstallIfNeeded()        在System.Windows.Forms.Control..ctor(Boolean autoInstallSyncContext)        在System.Windows.Forms.ScrollableControl..ctor()        在System.Windows.Forms.ContainerControl..ctor()        在System.Windows.Forms.Form..ctor()        在FssClient.Master..ctor()        在FssClient.Program.Main(String [] args)   InnerException:

0 个答案:

没有答案