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.