I am in the process of setting up a SharePoint Foundation 2010 machine. After installing SharePoint Foundation 2010 I noticed a warning in the Central Admin > Review problems and solutions report that the Security Token Service is not available.
The Security Token Service is not available.
The Security Token Service is not issuing tokens. The service could be malfunctioning or in a bad state.
The problem ended up being that the default configuration of the IIS Application Pools were set to 32-bit:
When SharePoint was installed all of the application pool accounts were added with 32-Bit enabled which prevented the SharePoint application pools from starting. I had corrected this for the Central Admin site and also the root SharePoint site but the application pools for the Security Token Service were still set to use the 32-Bit application which was preventing the service from starting.
Changing this setting in each of the application pools (there were several created so check them all) fixed the issue and then the warning went away.