How to use machine IP address ( https://192.168.1.102:5001) instead of localhost (https://localhost:5000) to host/run dotnet core application using Kestrel(Without IIS):
I am using the following configuration
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureKestrel(serverOptions =>
{
serverOptions.Listen(IPAddress.Loopback, 5000);
serverOptions.Listen(IPAddress.Loopback, 5001,
listenOptions =>
{
listenOptions.UseHttps("cert.pfx",
"123");
});
})
.UseStartup<Startup>();
});
I know we can use .UseUrls("http://192.168.0.101:5001") as follows, but this does not work with https
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.
UseKestrel()
.UseUrls("http://192.168.0.101:5001")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration().UseStartup<Startup>();
});
Any suggestion or guide would be appreciated, thanks in advance!