Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Reset IIS from C# code?

Reset IIS from C# code?

Scheduled Pinned Locked Moved C#
csharpcomwindows-adminquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mikker_123
    wrote on last edited by
    #1

    Is there some code snippet that would reset local IIS when used? Something like this one that starts browser from Windows application:

    Process p = new Process();

    // Here would go something like
    // p.StartInfo = new ProcessStartInfo("iisreset");
    // Instead of that below

    p.StartInfo = new ProcessStartInfo("http://www.nba.com");

    p.Start();

    Tnx!

    R 1 Reply Last reply
    0
    • M mikker_123

      Is there some code snippet that would reset local IIS when used? Something like this one that starts browser from Windows application:

      Process p = new Process();

      // Here would go something like
      // p.StartInfo = new ProcessStartInfo("iisreset");
      // Instead of that below

      p.StartInfo = new ProcessStartInfo("http://www.nba.com");

      p.Start();

      Tnx!

      R Offline
      R Offline
      Rei Miyasaka
      wrote on last edited by
      #2

      Process p = new Process();
      p.StartInfo = new ProcessStartInfo("net", "stop w3svc");
      p.Start();
      p.WaitForExit();
      p.StartInfo = new ProcessStartInfo("net", "start w3svc");
      p.Start();
      p.WaitForExit();

      You can use net start/stop with any of these (taken from here[^]): Iisadmin IIS Admin Service Msftpsvc FTP Publishing Service Nntpsvc Microsoft NNTP Service Smtpsvc Microsoft SMTP Service W3svc World Wide Web Publishing Service

      M 1 Reply Last reply
      0
      • R Rei Miyasaka

        Process p = new Process();
        p.StartInfo = new ProcessStartInfo("net", "stop w3svc");
        p.Start();
        p.WaitForExit();
        p.StartInfo = new ProcessStartInfo("net", "start w3svc");
        p.Start();
        p.WaitForExit();

        You can use net start/stop with any of these (taken from here[^]): Iisadmin IIS Admin Service Msftpsvc FTP Publishing Service Nntpsvc Microsoft NNTP Service Smtpsvc Microsoft SMTP Service W3svc World Wide Web Publishing Service

        M Offline
        M Offline
        mikker_123
        wrote on last edited by
        #3

        Tnx a lot man, I owe you one :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups