Couldn’t load assembly Antlr2.Runtime access denied

I had an interesting error happen when I was trying to run an MVC app for the first time which I have been assigned on my LR desk. Once the application gets loads it throws and error could not load file or assembly ‘Antlr3.Runtime or one of its dependencies access denied.


I was messing around with this error for almost 4 hours and tried everything I found on Internet.

  • Enter %TEMP% in the File Explorer and delete all the temporary files.
  • C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
  • C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files

But nothing worked for me.

Then I found that we have enabled identity impersonate in web.config


As we have enabled Impersonate this user will be used to execute the application. If I would have not mentioned any of the user than NT AUTHORITY\IUSR account would have been used. After messing things more around I checked that this User doesn’t has access to the folder.

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files.

So as soon as I gave permission to the User. The issue was resolved successfully. Sometimes things are simple that mess our whole day. Happy Learning.