ASP.NET ReportViewer Native compiler return value: ‘[BC2001] file’ error


Recently restored one of our servers and I encountered this error while trying to view a report:

An unexpected error occurred while compiling expressions. Native compiler return value: ‘[BC2001] file …. 

Solution:

1. Solving this seems so easy, first check the identity of the AppPool where the website is running:

2. From the command prompt type: %windir% and look for the temp folder. Add read/write permission to temp folder of windows to user in step 1.

Note: In other cases  the temp folder is located somewhere else, so to check where it’s located go to System Properties -> Advance -> Environment Variables. In the System Variables look  for the TEMP or TMP: