In the interests of adding more situations to this question (because this is where I looked because I was having the exact same problem), here's my answer:
In my case, I cut/pasted the text from the generic error saying in effect if you want to see what's wrong, put
<system.web>
<customErrors mode="Off"/>
</system.web>
So this should have fixed it, but of course not! My problem was that there was a <system.web> node several lines above (before a compilation and authentication node), and a closing tag </system.web> a few lines below that. Once I corrected this, OK, problem solved. What I should have done is copy/pasted only this line:
<customErrors mode="Off"/>
This is from the annals of Stupid Things I Keep Doing Over and Over Again, in the chapter entitled "Copy and Paste Your Way to Destruction".