I am using ASP.NET core 2.0.0 and using that I have created web application to run in HTTPS.To run in HTTPS I have used the following code in my Program.cs
string directory = Directory.GetCurrentDirectory();
string portNumber = Helper.getPortNumber(directory);
var cert = new X509Certificate2("file1.pfx", "ccc");
var host = new WebHostBuilder()
.UseKestrel(cfg => cfg.UseHttps(cert))
.UseUrls("https://localhost:53135")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
Then changed the APPURL to https://localhost:53135/. If I run the program I get the error as like below:
"An error occurred attempting to determine the process id of service.exe which is hosting your application.One or more errors occurred."
But if i give port number 44300 to 44399 no exception comes and the link gets hosted successfully.I have read in a link that to run IIS Express with SSL, port number should be in the range from 44300 to 44399.I need to run my application in all ports.Can anyone please guide me how to do that?