prevent ASP.NET core 3.1 app from using a particular port number code example
Example: .net core change localhost port
{
"iisSettings": {
"iisExpress": {
"applicationUrl": "http://localhost:12345",
"sslPort": 98765 <== Change_This
}
},