UPDATE: I managed to solve the issue after many weeks. Thank you all for your contribution. Apparently IIS does not load windows user profiles by default. So when running as a different user who is not logged on, their windows profile must be loaded by IIS. In advanced setting menu of your app pool, there is an option “load windows profile” I just changed this to true. In prior versions of IIS, this was set to ‘true’ by default.
Related questions on SO with same solution:
1) Security exceptions in ASP.NET and Load User Profile option in IIS 7.5
2) Running a asp.net web application project on IIS7 throws exception
3) System.Web.AspNetHostingPermission Exception on New Deployment