12

I can normally debug my web service with no problem, but now I persistently get error "Unable to launch the IIS Express Web Server. Port 3268 is in use". I have looked at previous questions about this, but I am stuck:

  • it doesn't matter what port I use

  • rebooting, closing web browser, deleting web history etc all fail

  • tools like TCPView show that the port is NOT in use

  • I can start/stop IISExpress from a command prompt OK

  • normally, address localhost:3268 shows an error message in a browser - but after loading the project in Visual Studio (and BEFORE starting to debug the project, or doing anything at all to it), localhost:3268 shows a web page in the browser

Graham Laight
  • 4,700
  • 3
  • 29
  • 28
  • View my Answer on this Thread https://stackoverflow.com/questions/22572897/why-and-how-to-fix-iis-express-the-specified-port-is-in-use/50234608#50234608 – SumairIrshad May 08 '18 at 13:19
  • Possible duplicate of [Why and how to fix? IIS Express "The specified port is in use"](https://stackoverflow.com/questions/22572897/why-and-how-to-fix-iis-express-the-specified-port-is-in-use) – Henke Oct 07 '19 at 16:23

5 Answers5

14

I was having these issues with specific projects.

For me,

  • no website was running iin IIS Express
  • nothing was using the port as determined by running: netstat -ano at the command line.

The solution was to run

netsh http add iplisten ipaddress=::

from the command line.

Happy days, and credit to: James Bryant! https://developercommunity.visualstudio.com/content/problem/110767/specified-port-is-in-use.html

Liam Fleming
  • 1,016
  • 12
  • 17
  • 2
    I have no idea what this does, but it worked for me. – Johnny Oshika Aug 06 '19 at 18:46
  • I tried it but it seems any website on IIS will stop working, only IIS express will work! – Ala' Alnajjar Aug 20 '19 at 09:43
  • One of the posts on the link you provided suggested that I stop the web site that used the port via IIS Admin. That worked. I was able to add the web site service reference and then restart the web site. – CAK2 Feb 13 '20 at 19:23
6

You can change the port of the website from the website properties under the web ribbon, specifying a different port other than 3268.

Also a link from the Stackoverflow discusses the same scenario

Why and how to fix? IIS Express "The specified port is in use"

Community
  • 1
  • 1
Krishna P S
  • 340
  • 2
  • 9
3

The link that Krishna provided inspired me to open IIS and discover that there was a local web site in IIS with the same port (it was the same web service). I deleted that, and now I can debug my application again.

I cannot explain why I couldn't see the port in use, why it started offering the web page when the project was loaded in Visual Studio, and why I couldn't see that IIS was running in the task manager. I am guessing that Visual Studio was actually running it somehow.

Thanks to all respondents for their help!

Graham Laight
  • 4,700
  • 3
  • 29
  • 28
  • 1
    When the website runs via IIS, there is a Process named w3wp.exe in the task manager. That indicates that the website is running via IIS – Krishna P S Jan 27 '16 at 05:45
1

1, firs click properties.

1. click properties

  1. Click web tab and in servers section change the port number. (simply increment or decrement the last digit

After that click "Create Virtual Directory" button. Then debug and run. Click web tab and in servers section change the port number

I hope this will solve your problem

Abdulhakim Zeinu
  • 3,333
  • 1
  • 30
  • 37
0

Close Visual Studio and delete the .vs folder (in the same folder where the .sln file is located.

enter image description here

napsebefya
  • 103
  • 1
  • 6