I have a web app on Azure and it looks like App Insights or some monitoring is pinging my home page every 5 minutes.
This is only annoying now that I have added a logging to my home page to record visit details.
Is there anything I can do about this. I tried to exclude these pings by doing:
var userHostIp = Request.UserHostAddress;
if ((string.IsNullOrEmpty(userHostIp) || !userHostIp.Equals("::1")))
{
Logger.Log("Page Visited: Home page");
}
As the IP address I see in the logs is ::1 but this doesn't work either.
It sounds like you have AlwaysOn
enabled in your app configuration, this periodically pings your app to keep it in memory thus avoiding cold starts.
If you want to stop the pings then you can simply disable that option. Alternatively, if you want to keep the pings on but avoid logging them, then you could try a looser comparison check e.g.
userHostIp.Contains("::1")
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