I had this error. It can also be caused by IIS Application Pool Setting having "Load user profile: false", which in our case was the default because we had installed "IIS6 compatibility" on the server.
Took me too many hours of googling to find the problem. Hopefully, I can help some other poor soul in the future.
See here: https://www.advancedinstaller.com/forums/viewtopic.php?t=26039