62

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 know how can I stop IIS in order to be able to start XAMPP? It appears that they use the same port. I guess those could be changed, but I do not want to interfere with other programs, and more than that I think this should be simpler.

Thanks!

Stas Ivanov
  • 1,173
  • 1
  • 14
  • 24
Michael
  • 4,786
  • 11
  • 45
  • 68
  • I faced the same issue, and found out that there was '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 – ni5ni6 Jun 14 '12 at 13:08

7 Answers7

98

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

msigman
  • 4,474
  • 2
  • 20
  • 32
  • 1
    Thank's for the advice, but I still can't start Apache. – Michael Mar 31 '12 at 13:58
  • Do CTRL ALT DEL and make sure all threads starting with IISexpress are terminated. Sometimes the helper threads get stuck and don't close. – msigman Mar 31 '12 at 15:03
  • Did that too, but with no success. I will just change the default 80 port for the Apache, with which I am more familiar with. Thx! – Michael Mar 31 '12 at 15:58
  • Hello, I have changed the apache config in order to make it listen to localhost:81 instead of localhost:80. Your suggestion is logical, but it didn't work for me at that time. I just reset :80 as port for my apache, exit from incon by the clock. Still not working.. I have tried CRTL ALT DEL, but I do not see there any proccess for iis express or related. It doesn't bother me if I use :81 for apache, but in order to help others for which my workaround is not an option, tell me what should be the name of the proccess so I try to stop it. Thanks for your kindness and patience! – Michael Apr 10 '12 at 21:10
  • Any way to do this from the command line -- so that we could use it as a prebuild step or something? – BrainSlugs83 Oct 20 '15 at 20:30
  • Very good documentation. Thank You, Changing the port number worked for me. – Nour Lababidi May 20 '16 at 19:57
18

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:

enter image description here

AlbertK
  • 11,841
  • 5
  • 40
  • 36
13

Open Task Manager and Kill both of these processes. They will autostart back up. Then try debugging your project again.

enter image description here

David
  • 3,488
  • 2
  • 21
  • 21
2

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
Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
James
  • 21
  • 1
0

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;
  }
}
George
  • 2,451
  • 27
  • 37
0

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

enter image description here

Twinkle B.
  • 23
  • 5
-8

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.

ryanne
  • 25
  • 1