instead of localhost, try can also the machine name or the IP address. I know on our machines, localhost didn't always work, although I don't recall the error (we're on 10.2.1). ...and keep in mind, localhost would only work when on the ArcGIS Server server itself, not from a separate machine.