Spark HTML generation fails: View source file not found

I use Spark as engine to generate all sorts of HTML but on Monday last week that specific code snippet failed without being changed. Spark indicated that it could not find the view file, so I checked and double checked that the view was in the correct place. This was as it should be, but still Spark threw the exception that it could not find the view source file. I decided to try the same code on my laptop and there Spark still worked as it should, so the issue was related to my development machine configuration.

Exception

When I further investigated the odd exception that was thrown, I saw that the inner exception was an AspNetHostingPermission exception.

So I checked all the rights on the folders where the view files resided and found nothing out of the ordinary. I really couldn't find anything that could've broken the HTML generating. So it was back to the drawing board, in my case Google, to search for possible causes and solutions. After a lot of searching and not finding very much answers I stumbled onto the following post. The error in that post was the same error that I got, but I was obviously not working with Windows 7 RC.

As solution the author states that you have to enable the 'Load User Profile' property of the application pool under which your web application runs. You can find the property in the advanced settings dialog of the application pool. Because being a bit really desperate I tried out the given solution and although I was rather sceptic to my surprise it worked.

IIS settings

I have no idea how that property got switched off in IIS, but if you ever have the same problem you'll hopefully won't look for a solution as long as I did. You've got the solution right here! 'Till next time.