I started to get this error message in an EPiServer Azure environment “out of the blue”, and I wasted a couple of precious hours trying to solve this issue with going back to previous web.config versions etc.
The solution was simple. I suddenly remembered that I had an interrupted update / publish from Visual Studio to the Web App. The solution was to clear the Web App completely and make a full republish. That worked and the error never appeared again 🙂