I have a .NET WCF Service application that is running on an Azure Virtual Machine. It connects and interacts with a Azure SQL Database that has been whitelisted and all works correctly. After some amount of time (usually 5 to 7 days), the Azure Virtual Machine can no longer connect to the Azure SQL Database. Here is what I have checked when it is in this broken state:
1) I have turned off connection pooling and checked "netstat -a" to see if my app is leaking connection when it gets to this state. It is not.
2) I pointed my local development machine (running the same app) at the Azure SQL Database. Everything works fine. No issue connecting.
3) I have tried to telnet from the Azure Virtual machine to the Azure SQL Database on port 1433. It does not connect. After the reboot I mention below, I can telnet to 1433 just fine.
4) I have tried to telnet from my local development machine to the Azure SQL Database on port 1433. It connects fine.
So, it appears to be an issue with the Virtual machine finding the Azure SQL Database.
To get it working again, I have to reboot the virtual machine. iisreset or cycling the application pools have no effect.
This has happened 5 times in the last month. Once I reboot the Virtual Machine it will work fine for approximately 5 to 7 days and then gets into this state again. It does not seem to recover on its own, as I have left it in this state for over a day to see if it would self-correct.
Any help to either resolve the issue or ideas on what to check when it gets in this state would be very much appreciated.