Every couple weeks, the enterprise security software takes my localhost port for its scanning stuff, so I try to run an app I am developing in visual studio, and the IIS Express tells me the port is taken. So I then have to find a new open por and change the solution properties. Then a couple weeks later, I will have to change again because the stupid security software has taken it for scanning.

Is there a way to permanently assign a port to localhost, or to visual studio, or however, so I don't have to keep changing every few weeks?

  • is your project based on the website or webapplication template? Aug 19, 2015 at 15:03
  • Web application.
    – BattlFrog
    Aug 19, 2015 at 15:08

1 Answer 1


No, you cannot assign a "permenant" port, because any unused port can be used by any application at any time, so there is no way to stop whatever software is stealing your port, when you use an On-Demand webserver like IIS 8 Express.

Instead, try using a port that no other application is likely to use, like one above 20,000, or one between 500 and 999. Most of the time apps will take the lowest port available above 1024, so ports well above that are less likely to conflict. Note that to use a port below 1024, you must run visual studio as an administrator. Stay away from ports less than 500, as there are many in use by well known network protocols.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .