Tuesday, October 8, 2013

Tuesday, March 12, 2013

Windows Service observations

Scenario: A windows service actively monitor the replication status in StatusDB. On status change, windows service open the configuration file of QuickSet service/Standard webservice and modify it. Windows service will also restart the IIS in order to reflect the configuration file changes immediately. This helps Quickset service/Standard web services in pointing to StandbyDB/LiveDB automatically.


Note:

  • Debugging windows service is a real bottleneck.
  • Use Microsoft event log for logging purpose. Event viewer helps to navigate through logs.
  • Test the code in console application, then move it to windows service
  • It is better to use SQL server authentication when connecting from windows service to SQL Server. 
  • If windows service runs under Local System, then it won't be able to create instance of SQL server connection. Service property > Log on > Select a network account.
  • Polling has to be done in a different thread.

Reference: