jay's old blog

this blog will be deleted soon - please visit my new blog - https://thesanguinetechtrainer.com

What is this localhost? And that number that comes after those words?

Whenever you run a website (after building) in visual studio, you will notice two things. On the bottom right corner of your PC, you will see a new icon appearing. And, the address bar of your browser will show something like ‘http://localhost:6969

I have observer even experienced developers wondering (or outright ignoring) what these two things are. Hence, making some notes here.

The blue icon

Okay the blue icon is actually IIS (Internet Information Services) running on your PC. The IIS is what makes your computer act like a server for the duration of the visual studio running your website. For extremely obvious reasons (like how your PC is not supposed to be web server), it won’t run all the time. However, your computer must pretend to be a web server if you are going to run web apps, and that is why IIS runs and then promptly quits when you stop running your web app from visual studio.

Of course, it is possible to make IIS run all the time on your desktop or laptop but that would be a story for another day.

The localhost thing and that number

Okay, so, you know what the blue icon does. Now that localhost thing. Well, when IIS runs, it has to run on IP address (because for the web, the IP address is the home). That IP address when your site is running locally is the localhost. It makes sense, as you can see ‘local’ plus ‘host’ equals localhost.

And that number is just the port number. Port numbers are ‘peep holes’ through which a server listens for incoming requests. On the web, there are many types of web traffic. For instance, FTP is one type of web request. Browsers make another type of web request. API calls make another type of web request. Mail systems have their own port numbers, and so do database requests.

The number you see after localhost is the port number on which your locally running IIS is listening to web requests.

Comments are closed