开发者

Running multiple executables from a windows service

开发者 https://www.devze.com 2022-12-17 23:34 出处:网络
I would like to achieve the following. I have a C# server application which is run by a Windows Service. The service currently requires that the server application is located in a specific directory.

I would like to achieve the following. I have a C# server application which is run by a Windows Service. The service currently requires that the server application is located in a specific directory.

Is it possible to create a Windows Service that takes a directory at start and run the application in that directory? How do you do that?

Can such a "configurable" service be used to start multiple application (executables with same name but located in different directories). This would be used to run different versions of a server applicat开发者_如何学运维ion in parallel. Or do you need one service per running instance?


Yes, simply set the context to reflect the desired environment.To do this use Environment.SetEnvironmentVariable.
A single service can start many applications, each with its environment. Use a configuration file or persistent data in the registry.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号