title: events handling in windows services
body: <p>I am new in creating windows services using C# framework 4.0, i have made a windows application that uses a DLL files to connect to a finger print attendance terminal.</p>
  <p>but i am confused in how to convert windows app to windows services.</p>
  <p>as i followed the tutorials i can run and install a simple services. but how to add new event in windows service</p>
  <p>so first i add reference to  my DLL file in project.
  second i added this code in the InitializeComponent method</p>
  <pre><code>    private void InitializeComponent()
      {  
          this.ServiceName = &quot;MyService&quot;;
          AxBioBridgeSDK.AxBioBridgeSDKX MyBio = new AxBioBridgeSDK.AxBioBridgeSDKX();
  
          MyBio.OnAttTransaction += new AxBioBridgeSDK.IBioBridgeSDKXEvents_OnAttTransactionEventHandler(this.axBioBridgeSDKX1_OnAttTransaction); // this is the event handler function
      }
  
      #endregion
      private AxBioBridgeSDK.AxBioBridgeSDKX MyBio;
  }
  </code></pre>
  <p>and in the <code>OnStart()</code> i add code to open connection with terminal.
  after i install the service and try to run it i get this error :</p>
  <blockquote>
  <p>Windows could not start the &quot;MyServiceName&quot; service on Local Computer.</p>
  <p>Error 1053: The service did not respond to the start or control request in a timely fashion.</p>
  </blockquote>
  <p>Any help?</p>