In this programming tutorial we will learn how to change default Port of the ASP.NET Development Server. Today one of my friend got alert message when he tried to view page in browser. He got this alert message. Unable to launch the asp.net development server because port '8080' is in use. We have solved this issue by changing the default port of the ASP.NET Development Server but there are two more ways to solve this issue as well. I will discuss those two ways as well in this tutorial. So lets start.
1) Change default Port of the ASP.NET Development Server
When you use the ASP.NET Development Server to run a file-system Web site, by default, the Web server is invoked on a randomly selected port for localhost. For instance, if you are testing a page called index.aspx and you run the page using the built-in ASP.NET Development Server also called Cassini Web Server, the URL of the page might be the following:
Port is assigned according to project location as well.
You have the option to select which port is used when using the built-in development server. The steps to specify the port to be used are slightly different for a website project or for a web application project.
To specify a port for the ASP.NET Development Server - WebSite / WebServices project
- In Solution Explorer, right click the name of the application.
- In the Properties pane, click the down-arrow beside Use dynamic ports and select False from the dropdown list. It will enable editing of the Port number property.
- In the Properties pane, click the text box beside Port number and type in a port number that you want.
- Click outside of the Properties pane. This saves the property settings.
Whenever you run a file-system Web site within Visual Web Developer or visual studio then the ASP.NET Development Server will listen on the specified port.
To specify a port for the ASP.NET Development Server - Web Application project
- Right click the Project in the Solution Explorer -> select Properties
- Click Web tab.
- Check Specific port rather than Auto-assign Port.
This was the one solution and it was also the topic of my tutorial. But the other two ways to fix the Unable to launch the asp.net development server because port '8080' is in use issue are quite simple.
2) Restart your system
Yeah in computer science restarting the system normally fix many issues :) . It is better to delete the temporary files by typing %temp% command in run before restarting the system.
3) Change the location of the folder
Change the location of the Folder contains all the files of your website, to some thing else. Load in project in visual studio or visual web developer whatever you have installed in your system and run the project again. and u have done it.
It will work because the ASP.NET Development Server chooses a new port number to run the project.
So that's it :)
I love your feedback.