郁闷 问啥内 。。是用 vs  c# winform 写的。。在自己电脑 好好的 。弄到服务器 运行一会儿就报错了

解决方案 »

  1.   

    看起来像是SQL连接太多没有关闭...加一个 UnhandledExceptionHandler . 参考 http://channel9.msdn.com/Forums/TechOff/258689-NET-20-Win-App-Eror-EventType-clr20r3/b7cba2321e53489692be9dfa008e8d39
    // C# 2.0
    static void Main(string[] args)
    {
      AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(
        delegate(object sender, UnhandledExceptionEventArgs e) {
          if (e.IsTerminating) {
            object o = e.ExceptionObject;
            Debug.WriteLine(o.ToString()); // use EventLog instead
          }
        }
      );  // rest of your Main code
    }
    // C# 3.0
    static void Main(string[] args)
    {
      AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(
        (sender, e) => {
          if (e.IsTerminating) {
            object o = e.ExceptionObject;
            Debug.WriteLine(o.ToString()); // use EventLog instead
          }
        }
      );  // rest of your Main code
    }