DarkLink DarkLink - 4 months ago 17
ASP.NET (C#) Question

ASP.NET Use Web.Config to control Port Number to host Web Application Project

I tried to search for this, but didn't found any good explanation.

I am trying to have everything configured on my config files, so it's easier for the user to control the publish and deploy of my application.

In visual studio 2015 I can control the port to host my web application going to:

Right Click Web Application Project > Properties > Web > Project Url

Can this be done by configuration file?

Thank you!


It can't be done by web.config but you can control it as,

For "Web Application Projects", open ".csproj" file look for the following part.


Notice the following lines where you can change the port and save it.


For the "Website projetcs" you have to open ".sln" file and change the port.

I hope the answer helps.