Why does the API connect to my paper trading account but not my live account?

TWS settings are saved separately for live and paper account users and need to be configured independently for each.  To configure, select the Edit and then Global Configuration options from the TWS menu and then the API and Settings from the Configuration pane. Then check the box for Enable ActiveX and Socket Clients.

In addition, a live user will have the TWS socket port (at API and Settings from the Configuration pane) set to 7496 by default, whereas a paper user will have the socket port set to 7497 by default. The socket port in an API application will need to be set to match the number chosen in the TWS or IB Gateway, respectively.

Powered by IBot
How do I disable the order preview screen in TWS?
Is it possible to disable the daily auto log off requirement?
Why are my TWS hotkeys not working in charts?
How can I determine which option contracts are in the money?