Tuesday, June 18, 2013

Journey to robust Windows Services: NHibernate throws with System.InvalidOperationException: Unable to generate a temporary class

Recently I've been trying to deploy a new web application to an old machine running Windows Server 2003 (not by choice). When I would start the application, NHibernate would thrown in its class constructor with a message along the lines of :
System.InvalidOperationException: Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\WINDOWS\TEMP\wz58eig4.0.cs' could not be found
error CS2008: No inputs specified
The problem was caused by the fact that the user under which I was running the application didn't have access to the 'C:\Window\Temp' folder where the temporary folder was being created. The solution was simple: update the security settings of that folder to allow Read and List for the Users group. The idea was given to me by answers to this question on Stack Overflow.

No comments: