title: Order Of Method Calls in a Windows Service
body: <p>In what order to the method calls happen in a windows service?  We are having a timing issue and I think it is due to the constructor taking too long to complete processing.</p>
  
  <p>This is a similar issue that I think we are having
  <a href="https://stackoverflow.com/questions/1673545/c-sharp-windows-service-error-1053-the-service-did-not-respond-to-the-start-or">Error 1053 the service did not respond to the start or control request</a></p>
  
  <p>However, we are wonder in what order and when the methods Main, OnStart, InitializeComponent etc get called and/or when they should be called.</p>
  
  <p>As well, would the OnStart method be the best place to put all of the processing?</p>
  
  <p>**Solution</p>
  
  <p>Made some time to make a test service and tested the responses below and found out the time out is coming from the Main method processing as well as the constructor being called in the Main method causing it to time out.  Moving everything to the OnStart as well as just spinning off a thread seemed to work.  Details here. <a href="http://www.adamthings.com/post/2012/06/28/error-1053-the-service-did-not-respond-to-the-start-or-control-request-in-a-timely-fashion/" rel="nofollow noreferrer">http://www.adamthings.com/post/2012/06/28/error-1053-the-service-did-not-respond-to-the-start-or-control-request-in-a-timely-fashion/</a></p>