I was getting the Internal Server Error (500) after upgrading to 4.0 from 3.90.
After much research, I read that the Settings.txt and InstalledPlugins.txt would automatically be converted to .json files, but I could see that they were still text files.
I was unable to get the stdout logging to work after enabling it in the web.config, but after changing permissions to allow modify permissions on the Logs folder for IUSR, I started getting output.
I saw this:
Application startup exception: System.Exception: Access to the path 'C:\inetpub\wwwroot\mywebsite\App_Data\installedPlugins.json' is denied.
So I changed permissions on the App_Data folder to allow IUSR/modify permission.
Then it seemed like maybe the site would load because it took awhile, but then the same Internal Server Error.
Now, a new stdout logfile was created with much information about how it created a new XML key (and I see the new file in the DataProtectionKeys folder).
So...the documentation for upgrading to 4.0 needs to also mention that the App_Data and Logs folders need IUSR/modify permissions.