It's basically a note to self in order to avoid having to research this ever again. I got "Retrieving the COM class factory for remote component with CLSID {XXXX} from machine localhost failed due to the following error: 80070005 localhost" error along with UnauthorizedAccessException in RuntimeTypeHandle.CreateInstance while attempting to call Activator.CreateInstance(Type type) to instantiate serviced component/COM+ object.
To work around, "Enforce access checks for this application" checkbox needs to be unchecked on the Security tab of COM+ application properties. To do it programmatically, the code will look like this:
COMAdminCatalogObject app;
// app = ...
app.set_Value("ApplicationAccessChecksEnabled", 0);