Hi @Anjali Agarwal ,
One thing you need to know is that https use 443 as default port. So only 443xxx ports can be used by https. When I change the port to 5000, it cannot work. But when I change 44319 to 44350, it can work well. HTTP and HTTPS cannot use same port. You cannot set both of them use 5000.
Another thing is change port in visual studio is not not really change. Each time you change the port, IIS express creates a new site with new url. The new url still points to the physical folder of application.
VS may have some problems and cannot use the updated port when debugging. You can directly change the port in the browser.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Bruce Zhang