Automagically start/stop Photon application

edited January 2011 in Photon Server
Is there a way to automatically start/stop the Photon application?

I find myself performing the following steps frequently, and the time accumulates:

1. Right click PhotonControl in task bar
2. Choose "Photon".
3. Choose "Stop application".
4. Build from Visual Studio
5. Right click PhotonControl in task bar
6. Choose "Photon".
7. "Choose "Start application".

Is anyone else doing the same? I really wish I could automate this with a pre and post build step, somehow.


  • if it is on the same machine you could add pre and post build steps in VC# that call the command line to stop and start the server, I'm pretty sure thats possible, the command line args are just not documented at the moment I think
  • You can use command-line arguments to start and stop Photon as a service. The "run as application" option can not be stopped this way yet.

    We are working towards a new version where you can use a "shadow copy" option for the assemblies. This will auto stop and start when you change the files in the bin folder.
  • Would it be possible to just have a console application to run our applications during development? This would be easiest for debugging.
  • only if your application does not require to use photon during that time.
    Otherwise no as the socket server is a distinct, unmanaged application which implements "C# scripting" (through CLR I think) so either your application runs on that or does not.
    you can hook in with the debugger into the running application though to debug it that way, but you can't debug the startup naturally
  • Thanks but what i was saying it would be nice if Photon has a application console project we could run from inside Visual Studio, that would be easiest and fastest way to develop.
  • With the shadow copy it would "feel" like that. You will be able to compile and the code gets used after a small timeout with automatic restart of the app.
    You could also setup PhotonSocketServer.exe as debug executable in VS, I think. However you would not be able to change code while you run it.
  • Thanks, the service set-up with the command line start/stop commands seem to be what I want.
  • Any news on shadow copy or is it implemented already? Maybe tray icon can get enhanced functionality like left-click doubleclick would start/stop application? Theres no point to it having context menu on both buttons :).
  • Xeevis,
    that "doubleclick on PhotonControl" is a nice idea. When we make Photon Control to handle multiple instances of Photon, we can probably add this, too.

    Starting applications as "shadow copy" is already in the released SDK. It will become the default way to start applications in the next SDKs config.
    Per application you can add the attribute EnableAutoRestart="true". On file-change, this will start a new application instance. New connections will use this, remaining connections will keep the older copies alive until everyone disconnected.
    There are more options, described in the server SDK doc\photon-configuration.pdf and I will write a Developer Network page with some details.

    Edit: You can't use the watch and exclude attributes yet. I just found out it's not working as expected in that release. Next release will be done in the next few days.
  • In the new Server SDK, we changed the configuration to load applications from a shadow copy and made it restart as default.
Sign In or Register to comment.