I had the same error, I was going to pull my hair out for this problem, tried all the approaches mentioned in Stackoverflow and other sources, none of them worked. Finally, I realized that the problem was from my web.config file . I published a local web.config file on the server.
I copied another web.config server file from another identical server (which worked well) and the problem is resolved and life became beautiful again!
I can confidently say that something is wrong with your web.config file
source share