All of a sudden from about 8AM this morning a particular query from my website has been firing hundreds of thousands of times an hour, this is within a WebAPI method which is called from a mobile application.
This is causing my website to grind to a halt and be unusable.
I've tracked down the query, but I cannot work out how/why it would be called so many times? I was thinking perhaps this was a DDOS attack, so I added some extra logging around that SQL query, however it is not being hit at all hardly, certainly not thousands of times.
Can anyone shed any light into how I can stop this? I wonder if something has been stuck in a loop somewhere perhaps?
I would use Azure Applications Insights to get to the root cause of this. Install the SDK. It will give you which controller and what dependencies are involved, and why the instruction gets called. Applications Insights will give you the whole mapping. Here you will find how to install it.
Usually exporting IIS logs to SQL Server and perform some data mining there helps analyze and debug issues. For information about how to do it visit this blog post.