0
Posted on 8:56 AM by Softminer and filed under

Visual studio should run as Administrator:

Process cmd = new Process();
            ProcessStartInfo info = new ProcessStartInfo(@"cmd.exe", "");
            info.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            info.WorkingDirectory = @"c:\";
            info.RedirectStandardInput = true;
            info.RedirectStandardOutput = true;
            info.RedirectStandardError = true;
            info.UseShellExecute = false;
            info.CreateNoWindow = true;

            cmd.StartInfo = info;
            cmd.Start();

            cmd.StandardInput.WriteLine(@"c:\Windows\system32\inetsrv\appcmd 
            recycle apppool /apppool.name:DefaultAppPool");

            cmd.StandardInput.Flush();
            cmd.StandardInput.Close();
            string output = cmd.StandardOutput.ReadToEnd();
0
Responses to ... Restarting application pool with C#