SCOM Web Console Runtime Error with 1310 in application log

Here is a nice variation on the runtime error after installing the SCOM web console.
A very well known error that looks exactly the same is discussed here for instance and is caused when the correct dll files are not in the web console bin directory, in some case caused by first installing the full scom console gui, followed by the web console later.
However what we ran into today was different as those files did exist and no scom console was installed, except for the web console.
Situation:
Windows 2008 R2 SP1
SCOM 2007 R2 CU4
Installed a separate machine and installed SCOM Web Console on it.
When accessing we found the following error:
Server Error in ‘/’ Application.
Runtime Error

Here is a screenshot of the same:

Investigation:
When looking at the application event log we saw a warning event:
Log Name: Application
Source: ASP.NET 2.0.50727.0
Event ID: 1310


In the description of that event was a lot of text and a few lines stood out:
Event code: 3006
Event message: A parser error has occurred.
Exception information:
Exception type: HttpParseException
Exception message: (0): error CS0016: Could not write to output file ‘c:WindowsMicrosoft.NETFramework64v2.0.50727Temporary ASP.NET Filesrootf9fd7c9ee9f26d13App_Web_headercontrol.ascx.7e693e39.pg3_y6db.dll’ — ‘Access is denied. ‘
Alright, we are closing in. It is an access denied in a folder somewhere. 🙄
Did a lot of searching around on the net and saw a few posts regarding the rights on temporary folders. Not all were the same, some were not listed as answered and some were. But it got me on the right track, and the right track is NOT the directory that was indicated!!!
Solution:
In the end I found this to be the solution for this specific case:
Make sure you give WRITE access to the C:WIndowsTemp directory to:
NETWORK SERVICE
IIS_IUSRS

In our case the IIS_IUSRS group (it is a local group on your server) did not have write access to the “C:WindowsTemp” folder. Once this was granted everything worked again and we got a login form from SCOM Web Console.

Happy happy joy joy!
Its the week of strange issues!
Bob Cornelissen