如题
        private void button1_Click(object sender, EventArgs e)
        {
            Process p = new Process();
            p.StartInfo.FileName = "cmd.exe";
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardInput = true;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError = true;
            //p.StartInfo.CreateNoWindow = true; true表示不显示黑框,false表示显示dos界面
              p.Start();
            p.StandardInput.WriteLine("d:");
            p.StandardInput.WriteLine("md 谦虚的天下");
            p.StandardInput.WriteLine("cd 谦虚的天下");
            p.StandardInput.WriteLine("md libai");
            p.Close(); 
        }ExitCode“p.ExitCode”引发了“System.InvalidOperationException”类型的异常 int {System.InvalidOperationException}

解决方案 »

  1.   

    System.InvalidOperationException 超时时间已到。在从池中获取连接之前超时时间已过。出现这种情况可能是因为所有池连接都已被使用并已达到最大池大小。
    WEB.config 里面:
    在数据库连接加 Max Pool Size = 512;
    server=local;uid=;pwd=;database=2004;Max Pool Size = 512;">
      

  2.   

    微软的bug.其官方网站提到过的。
    解决办法
    修改注册表信息 
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance 下面的键值Disable Performance Counters 设置为  0 。