public class MoveListen
    {
        public MoveListen()
        {
            //
            //TODO: 在此处添加构造函数逻辑
            //
        }        [STAThread]
        public static void Main(string[] args)
        {
            //Run是监听方法
            Thread.CurrentThread.Name = "ListenVideo";
            Thread t = new Thread(new ThreadStart(Run));
            t.Start();
            Console.ReadLine();
        }
        ..........

解决方案 »

  1.   

    你的线程不就只有一个 你在run里面加循环44
      

  2.   

    do{}
    while(true)  加入run中
      

  3.   

    你这是启动了一个线程,这个线程只执行你的Run方法,如果你Run方法只进行一次就结束了,这个线程也就结束了,呈休眠状态,所以要看你的run方法了!
      

  4.   

    你只是监测了一次 放到while中吧
      

  5.   

     /// <summary>
            /// 监听文件夹
            /// </summary>
            public static void Run()
            {
                // Create a new FileSystemWatcher and set its properties.
                FileSystemWatcher watcher = new FileSystemWatcher();
                watcher.Path = "E:\\Customer\\Upload\\file\\";
                watcher.IncludeSubdirectories = true;
                //监听类型
                watcher.NotifyFilter = NotifyFilters.FileName;
                //监听该文件夹中的所有文件
                watcher.Filter = "*.*";            // 执行操作
                watcher.Created += new FileSystemEventHandler(OnChanged);
                watcher.Deleted += new FileSystemEventHandler(OnChanged);
                watcher.Renamed += new RenamedEventHandler(OnRenamed);            // 启用监听
                watcher.EnableRaisingEvents = true;            //// 等待用户退出
                //Console.WriteLine("Press \'q\' to quit the sample.");
                //while (Console.Read() != 'q') ;
            }
      

  6.   

    对啊,这是为什么呢?????????????
    因为你再run()里面少了一个while!!!
      

  7.   

    加do{}while();之后不执行了!然后内存会不断增长!
      

  8.   

    另外 用用 定时器 也不错哦,Timer
      

  9.   

    猜测一下吧
    FileSystemWatcher 当前是局部变量, 有可能一出 RUN 就被释放了, 放到外面试下
      

  10.   

    FileSystemWatcher watcher = new FileSystemWatcher();  作为全局变量。 不要放在方法里。