I want to get host name/address in .net core application to create connection string dynamically in the ConfigureServices. I have tried so many ways. How can i get the Request detail in startup.cs files
try this:
public static string GetAddressIP()
{
return Dns.GetHostAddresses(Dns.GetHostName())
.FirstOrDefault(ha => ha.AddressFamily == AddressFamily.InterNetwork)
.ToString();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With