Go Back To Code List
[Visual Studio]
Current Code Entry
Go Back To Code List
[Visual Studio]
  • Visual Studio - Change port number for all website projects

    Article Entry Date: March 19,2026 @ 09:32:22 / Last Updated On: March 19,2026 @ 09:34:32
Change the port number for each Visual Studio website project, making it easy to work on multiple website projects without the hassle of closing out the open website to release the port it is using. Typically, this is port 51910.

This took me a while, and finally I found the right files to edit.
Close out of the solution you are working on; you do not have to close VS, just the solution.

You have two files in two locations.
First, you must have [Show Hidden files, folders, and drives] enabled.
Open Search and type [CP]
You will see two options. [Command Prompt] and [Control Panel].
Choose [Control Panel].
When the window opens, click on [File Explorer Options]
Click the [View] tab.
Under [Hidden Files and Folders]
[[x] Show hidden files, folders, and drives].
Click [OK] to the Prompt.
Click [Apply] and then [OK].

▼ File #1 ▼

Inside your project Folder.
Open the [.vs] folder
Then open the [sitename.slnx] folder
Next, open the [config] folder
Open [applicationhost.config] in your favorite editor. I use [Notepad++]
Search []
You should see two locations.

(Multiple is the name of my site; yours will be different)

Under the [id="2"], you should see something like this.

Change the port number to 11 "51911"

[Save] the file

▼ File #2: ▼

Inside your project folder, open the [.slnx] file. (Mine is [Multiple.slnx])
The last property in the file should be.

Change the number to match the one we did above.

[Save] the file and open the solution up in [VS], and run it.
You will now be running on [Port 51911] while the other site is running on [Port 51910].

Perform the above on each website you create, making it easier to keep track of all sites that are running without the dreaded port conflict error.