为什么以下代码窗口服务仅启动第一个实例?
List<MyserviceBaseInheritedClass> ServicesToRun = new List<MyserviceBaseInheritedClass>();
foreach (MyBusObj.Client client in _Clients)
{
MyserviceBaseInheritedClass srvBase = new MyserviceBaseInheritedClass();
srvBase.ServiceName = "PREFIX" + client.ClientName.Trim();
ServicesToRun.Add(srvBase);
}
if (ServicesToRun.Count > 0)
{
//// create all the services
//// one per client
/////////////////////////// SERVICE ENTRY POINT
ServiceBase.Run(ServicesToRun.ToArray());
////////////////////////////////////////////
}
是的,Service Base实际上是相同的服务,但它根据来自DB的配置完全不同地读取和操作