My c# console app runs on an different machine than my SQL Server 2014. I use ado.net to connect to it. How can I detect if the sql server automatically reboots after installing windows updates? On my client application I use SystemEvents_SessionEnding but this does not help me.
I read about connection resiliency, but this seems also not to solve this problem.
Is there a specific ado.net event I can capture? Creating an app on the server sending UDP is not my prefered solution, aswell I dont want to use ping etc.
I'm really looking for something like an event to react on.
eg the notification services: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlnotificationinfo(v=vs.110).aspx
Thanks!
If you want to see if the server is down or not you can use Ping Class.
using System.Net.NetworkInformation;
var ping = new Ping();
var reply = ping.Send("SqlServerIP");
if (reply.Status == IPStatus.Success)
{
//server is available
}
else
{
//server is down
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.