I had this problem and it bugged me for ages. I noticed my server I was trying to get my site working on had a stack more modules listed in IIS than the server that worked. I removed them from the Website on IIS and redeployed the code and it worked perfectly. I did try doing an IIS reset and an app pool recycle but they didn't work which surprised me but definitely a redeployment did the trick.
It's worth saying that its likely that not all the modules need removing but when I was testing I didnt redeploy after I removed a module and I still had the problem.
Hope this helps