How do I start/stop IIS Express Server?

前端 未结 6 1333
鱼传尺愫
鱼传尺愫 2020-12-16 08:53

I have installed MS Visual Web Developer 2010 which includes IIS Express.

Before this, I had installed XAMPP server for my php applications.

I would like to

相关标签:
6条回答
  • 2020-12-16 09:27

    An excellent answer given by msigman. I just want to add that in windows 10 you can find IIS Express System Tray (32 bit) process under Visual Studio process:

    0 讨论(0)
  • 2020-12-16 09:30

    You can stop any IIS Express application or you can stop all application. Right click on IIS express icon , which is located at right bottom corner of task bar. Then Select Show All Application

    0 讨论(0)
  • 2020-12-16 09:33

    I came across the same issue. My aim is to test PHP scripts with Oracle on Windows 7 Home and without thinking installed IIS7 express and as an afterthought considered Apache as a simpler approach. I will explore IIS express's capabilities seperately.

    The challenge was after installing IIS7 express the Apache installation was playing second fiddle to IIS express and bringing up the Microsoft Homepage.

    I resolved the port 80 issue by :-

    1. Stopping Microsoft WedMatrix :- net stop was /y
    2. Restarted the Apache Server
    3. Verifying Apache now was listening on the port :- netstat -anop
    4. Clearing out the Browsers caches - Firefox and IE
    5. Running localhost
    0 讨论(0)
  • 2020-12-16 09:33

    Here is a static class implementing Start(), Stop(), and IsStarted() for IISExpress. It is parametrized by hard-coded static properties and passes invocation information via the command-line arguments to IISExpress. It uses the Nuget package, MissingLinq.Linq2Management, which surprisingly provides information missing from System.Diagnostics.Process, specifically, the command-line arguments that can then be used to help disambiguate possible multiple instances of IISExpress processes, since I don't preserve the process Ids. I presume there is a way to accomplish the same thing with just System.Diagnostics.Process, but life is short. Enjoy.

    using System.Diagnostics;
    using System.IO;
    using System.Threading;
    using MissingLinq.Linq2Management.Context;
    using MissingLinq.Linq2Management.Model.CIMv2;
    
    public static class IisExpress
    {
      #region Parameters
      public static string SiteFolder = @"C:\temp\UE_Soln_7\Spc.Frm.Imp";
      public static uint Port = 3001;
      public static int ProcessStateChangeDelay = 10 * 1000;
      public static string IisExpressExe = @"C:\Program Files (x86)\IIS Express\iisexpress.exe";
      #endregion
    
      public static void Start()
      {
        Process.Start(InvocationInfo);
        Thread.Sleep(ProcessStateChangeDelay);
      }
      public static void Stop()
      {
        var p = GetWin32Process();
        if (p == null) return;
    
        var pp = Process.GetProcessById((int)p.ProcessId);
        if (pp == null) return;
    
        pp.Kill();
        Thread.Sleep(ProcessStateChangeDelay);
      }
      public static bool IsStarted()
      {
        var p = GetWin32Process();
        return p != null;
      }
    
      static readonly string ProcessName = Path.GetFileName(IisExpressExe);
      static string Quote(string value) { return "\"" + value.Trim() + "\""; }
      static string CmdLine =
        string.Format(
          @"/path:{0} /port:{1}",
          Quote(SiteFolder),
          Port
          );
      static readonly ProcessStartInfo InvocationInfo =
        new ProcessStartInfo()
          {
            FileName = IisExpressExe,
            Arguments = CmdLine,
            WorkingDirectory = SiteFolder,
            CreateNoWindow = false,
            UseShellExecute = true,
            WindowStyle = ProcessWindowStyle.Minimized
          };
      static Win32Process GetWin32Process()
      {
        //the linq over ManagementObjectContext implementation is simplistic so we do foreach instead
        using (var mo = new ManagementObjectContext())
          foreach (var p in mo.CIMv2.Win32Processes)
            if (p.Name == ProcessName && p.CommandLine.Contains(CmdLine))
              return p;
        return null;
      }
    }
    
    0 讨论(0)
  • 2020-12-16 09:37

    Closing IIS Express

    By default Visual Studio places the IISExpress icon in your system tray at the lower right hand side of your screen, by the clock. You can right click it and choose exit. If you don't see the icon, try clicking the small arrow to view the full list of icons in the system tray.

    IIS Express icon

    then right click and choose Exit:

    enter image description here


    Changing the Port

    Another option is to change the port by modifying the project properties. You'll need to do this for each web project in your solution.

    1. Visual Studio > Solution Explorer
    2. Right click the web project and choose Properties
    3. Go to the Web tab
    4. In the 'Servers' section, change the port in the Project URL box
    5. Repeat for each web project in the solution

    Changing the IIS Express port


    If All Else Fails

    If that doesn't work, you can try to bring up Task Manager and close the IIS Express System Tray (32 bit) process and IIS Express Worker Process (32 bit).

    Terminating the IIS Express Worker Thread process

    If it still doesn't work, as ni5ni6 pointed out, there is a 'Web Deployment Agent Service' running on the port 80. Use this article to track down which process uses it, and turn it off:

    https://sites.google.com/site/anashkb/port-80-in-use

    0 讨论(0)
  • 2020-12-16 09:52

    to stop IIS manually:

    1. go to start menu
    2. type in IIS

    you get a search result for the manager (Internet Information Services (IIS) manager, on the right side of it there are restart/stop/start buttons.

    If you don't want IIS to start on startup because its really annoying..:

    1. go to start menu.
    2. click control panel.
    3. click programs.
    4. turn windows features on or off
    5. wait until the list is loaded
    6. search for Internet Information Services (IIS).
    7. uncheck the box.
    8. Wait until it's done with the changes.
    9. restart computer, but then again the info box will tell you to do that anyways (you can leave this for later if you want to).

    oh and IIS and xampp basically do the same thing just in a bit different way. ANd if you have Xampp for your projects then its not really all that nessecary to leave it on if you don't ever use it anyways.

    0 讨论(0)
提交回复
热议问题