I upgraded my SharePoint Foundation farm (there’s only one node) to SharePoint 2010 Server as the time had come in the lifecycle of my proof-of-concept (PoC) to integrate the user profile service application into the mix. The PoC consisted of two web applications over and above the central administration web application: KERBWEB and ADFSWEB. As you can probably guess from the simplistic naming of the web applications one utilises Integrated Windows Authentication (Negotiate (Kerberos), not NTLM) and the other a trusted identity provider (an AD FS claims provider).
After the upgrade my Kerberos-only web application was working fine but my claims-based web application wouldn’t work. The error was:
HTTP Error 500.19 – Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
The detailed error information provided me with everything I needed to locate and remedy the issue:
Error code: 0x800700b7
Config Error: Config section ‘appSettings’ already defined. Sections must only appear once per config file. See the help topic <location> for exceptions
Config File: \\?\C:\inetpub\wwwroot\wss\VirtualDirectories\adfsweb.adatum.com80\web.config
Within the detailed error the “config source” section even told me where in the file to look.
802: <appSettings />
After staring at the page blankly for about five minutes I realised the obvious. For whatever unknown reason at some point during the upgrade from SharePoint Foundation to SharePoint 2010 Server the applicationHost.config file for the SharePoint web application had managed to get a second, empty, appSettings element inserted right at the end of the file.
Opening the file using elevated credentials I simply commented out the problematic section, saved and reloaded the page (changes are immediate, there’s no need to restart the web site or recycle the application pool) and all was well.
So, the moral of this story is read the detailed error information provided by IIS and if IIS tells you that you have too many <appSettings> nodes you do, so get rid of one of them!
FYI here is what lines 801, 802, 803, 804 and 805 now look like:
802: <!-- This second appSettings element was mistakenly added by the SP
803: upgrade and kills the app. commented to fix issue
804: <appSettings /> -->