Where should I put service initialization code?

In general, all service initialization should be done in the following locations and not in main() or in the constructor of ServiceContainer():
  • C++: ServiceContainer::onCreateService()
  • Java™: ServiceContainer.onCreateService()
  • .NET: ServiceContainer.OnCreateService()