Home Help Center

Help on creating services w/ ICE

stephanstephan Member Stephan StapelOrganization: Stephan StapelProject: BristolNG
Hi there!

I'm currently playing around with creating and running services in combination with ICE.
I've modified the mservice implementation available 'somewhere' on the net and put those function into two classes that basically follow the Qt design principles (i.e. I chose using "private classes"). in this case the private class comes with tons of static functions for controlling the service.

I included a small service application that consists of:
A VS7 project file,
A sample service ('CMyService') which doesn't do anything that makes a lot of sense (but the service works :-) ),
Also included (and linked in from within the project file) is a very simple ICE object (HelloWorld respectively HelloWorldI class).

In order to install the service, first compile and link the project, then enter the command-line and run 'mservice -install' and afterwards enter the service management tool and start the service.
For removing the service, first stop it and then type 'mservice -remove'.

However, the problem I run into is:
When I try to run the service executable with the Ice classes HelloWorld and HelloWorldI linked in, the service won't start.
When running it without those two classes (no change necessary apart from removing the files from the project browser), everything runs fine.

So I suspect that there is a dependency between Ice and the problems I run into when trying to start the service.
It would be really nice if you could help me out of this or -- if you've tried it by yourself -- upload a working service example.

Kind regards,

Stephan

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    I haven't had a chance to look at your attachment yet, but I assume when you say "service" you mean a "Windows service"?

    If so, I just wanted to mention that Ice will include support for running the Glacier starter and IcePack servers as Windows services or Unix daemons in the next release. These servers will use a new base class called Ice::Service, which is similar to Ice::Application but encapsulates the platform-specific code for an application that wants to run as a daemon or service. We'll also provide an implementation of Ice::Logger that uses the Windows event log.

    I'm not exactly sure what could cause your Ice service to fail, but I did encounter a few issues when I was working on Ice::Service. For example, I had to ensure the Ice DLLs and configuration files could be found by the service, and I had to configure a service to start under my user name so that it could write files in a directory I created.

    Take care,
    - Mark
  • stephanstephan Member Stephan StapelOrganization: Stephan StapelProject: BristolNG
    Hi Mark!

    Thanks for the very quick reply!
    Hi,

    I haven't had a chance to look at your attachment yet, but I assume when you say "service" you mean a "Windows service"?

    Oops. Yes :-)

    If so, I just wanted to mention that Ice will include support for running the Glacier starter and IcePack servers as Windows services or Unix daemons in the next release.

    Does this "only" count for Glacier and IcePack or also for using 'pure' Ice?

    I'm not exactly sure what could cause your Ice service to fail, but I did encounter a few issues when I was working on Ice::Service. For example, I had to ensure the Ice DLLs and configuration files could be found by the service, and I had to configure a service to start under my user name so that it could write files in a directory I created.

    Hmm. I made both issues sure for the service but unfortunately without success :-(

    The final question that remains open is when the next release will be available. IIRC the release date should be rather soon, isn't it?

    regs,

    Stephan
  • stephanstephan Member Stephan StapelOrganization: Stephan StapelProject: BristolNG

    Hmm. I made both issues sure for the service but unfortunately without success :-(

    args. You were true! The problem was that the ICE DLLs were only accessible by making use of the PATH environment variable which doesn't seem to be possible for services. When copying/ moving them into the system32 directory, the service runs flawlessly!

    Could you please nevertheless try to answer my questions?

    Kind regards,

    Stephan
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    I'm glad you discovered the problem.
    Originally posted by stephan
    Does this "only" count for Glacier and IcePack or also for using 'pure' Ice?
    Sorry, I don't understand your question. The Glacier starter, IcePack registry and IcePack node servers use the Ice::Service class and therefore can be run as Unix daemons or Windows services in the next release. In addition, your applications can use the Ice::Service class.
    The final question that remains open is when the next release will be available. IIRC the release date should be rather soon, isn't it?
    I expect it will be available in February, but I can't predict exactly when yet.

    Take care,
    - Mark
  • stephanstephan Member Stephan StapelOrganization: Stephan StapelProject: BristolNG
    Hi Mark!

    What I wanted to figure out with my previous posting was, if the service functionality is limited to icepackregistry/ -node and objects being managed by the nodes.
    In addition, your applications can use the Ice::Service class.

    So if I understand correctly, this means that I can make any Ice server application run as a service by more or less replacing my Ice::Application constructs by Ice::Service equivalents.

    I expect it will be available in February, but I can't predict exactly when yet.

    That's fairly good news. So max just 27 more days to go :-)


    Stephan

    P.S.: Yet another 'next release' question: Will the new release come with a tutorial or step-by-step guide to implementing servers using icepack? Imho this would be really helpful for improving Ice-based implementations!
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Originally posted by stephan
    What I wanted to figure out with my previous posting was, if the service functionality is limited to icepackregistry/ -node and objects being managed by the nodes.
    No, it's not restricted in that way.
    So if I understand correctly, this means that I can make any Ice server application run as a service by more or less replacing my Ice::Application constructs by Ice::Service equivalents.
    That's correct. However, an IcePack-managed server should not run as a service. The server can still use Ice::Service in case it needs to be capable of running as a standalone service, it just shouldn't run as a service when activated by an IcePack node.
    P.S.: Yet another 'next release' question: Will the new release come with a tutorial or step-by-step guide to implementing servers using icepack? Imho this would be really helpful for improving Ice-based implementations!
    That's a good idea, but I can't promise it will be included in the next release.

    Take care,
    - Mark
Sign In or Register to comment.