I think, for me, it is environmental.
I came to a conclusion years ago that maybe people can only like me once they get used to me.
So if I'm in an environment, such as a workplace, where people have to interact, then they get used to me, and some might be extra friendly in a way that I can respond to. And if they are naturally friendly to others as well, then so can I be.
But in an environment where people only get to know each other by choice, I don't do well at all, since I can only do the 'pleasant to strangers' part and can't progress that in any way, so nobody gets to know me enough to get used to me, and presumably doesn't see anything to like.
I don't know if that is a good analysis, but it's the best explanation I can find for why I have done well at times, yet at other times have been friendless, despite putting myself into all the usually recommended social situations over and over again.
Perhaps there are people who are natural ice-breakers, who can somehow bypass the insecurities that AS brings.
I have found that if I attempt to initiate friendship, it backfires, so presume that, by trying, I come across as creepy in some way.