Click here to Skip to main content
15,867,568 members
Articles / Web Development / IIS
Tip/Trick

Specifying Ports When Running Applications in Visual Studio

Rate me:
Please Sign up or sign in to vote.
4.20/5 (3 votes)
10 Oct 2013CPOL1 min read 28.1K   2   2
This post will provide a short walk-through for handling and updating these areas of your application to gain more control over debugging, testing and running your applications through Visual Studio.

I’ve come across several questions over the past few months with developers asking questions regarding the port values that are used when running applications through Visual Studio, primarily where are the values coming from and how to set them. Although this may be a fairly trivial topic, it appears that many users are unaware that the ports that are being used aren’t always as “random” as they may initially appear.

This post will provide a short walk-through for handling and updating these areas of your application to gain more control over debugging, testing and running your applications through Visual Studio.

The Problem

You have multiple Projects that are within your Solution that are going to be running along-side one another and you want to assign explicit ports to each of them (because you don’t want to have to type a different port within your browser each time).

The Solution

You can set these properties depending on if you are using the local Visual Studio Development Server or through IIS within the Properties of your current Project through the following steps :

  • Right-click on your Project within the Solution Explorer in Visual Studio.
  • Select the Web tab on the left-hand side.
  • You should find a section called Servers within the right-hand pane.
  • You should then see the following area that will allow you to either explicitly use a Specific Port or Auto-Assign Port.
Visual Studio IIS and Server Settings

You can control information about the Ports and Visual Studio Hosting environment easily.

Each of the sections listed within the Servers area will permit you to make changes to the environment that your applications are run in during the debugging process and should provide a bit more control for you (especially if you need to test specific features and functionality through IIS.)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
An experienced Software Developer and Graphic Designer with an extensive knowledge of object-oriented programming, software architecture, design methodologies and database design principles. Specializing in Microsoft Technologies and focused on leveraging a strong technical background and a creative skill-set to create meaningful and successful applications.

Well versed in all aspects of the software development life-cycle and passionate about embracing emerging development technologies and standards, building intuitive interfaces and providing clean, maintainable solutions for even the most complex of problems.

Comments and Discussions

 
QuestionHow about newer versions of Visual Studio? Pin
RodAtHome3-Feb-23 11:20
RodAtHome3-Feb-23 11:20 
QuestionDoes not work Pin
Member 1109660812-Apr-18 9:47
Member 1109660812-Apr-18 9:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.