In my case, the error happens when the version specified in web.config's of the dependent assembly (e.g. Newtonsoft.Json) doesn't match the version that is actually in the bin folder. Once the version number in the web.config is updated, the problem is fixed.