Archived

This forum has been archived. Please start a new discussion on GitHub.

Server running as a Windows Service

Hi,

We are using Ice 3.5.0 and .NET and added the necessary client-server functionality and have tested locally. No issues!.

We have deployed the server component to the Windows 2003 server, configured the host settings, and ran it as a the console host. No issues!

But when we deployed the server a Windows Service, noticed that the Ice runtime is not getting initialized and at the same time no exceptions are thrown.

We are seeing the below log entry:
public void Start()
{
if( false == this._isRuntimeInitialized)
{
_log.Info("Initializing Ice runtime...");
Task.Factory.StartNew(() => main(new string[] { }, _configName));
}
}

But it is not making to the run call:

public override int run(string[] args)
{
try
{
_isRuntimeInitialized = true;
if (null != IceRuntimeInitialized)
{
IceRuntimeInitialized(this, EventArgs.Empty);
}

Ice.ObjectAdapter adapter = communicator().createObjectAdapter( this._adapterName);
adapter.add(this._iceServant, communicator().stringToIdentity(this._adapterName));
adapter.activate();
_log.Info("Ice runtime initialized, now server can process requests.");

communicator().waitForShutdown();
}
catch (Exception exception)
{
_log.Error("Error occurred in Ice runtime: " + exception.Message, exception);
}
return 0;
}

Please advise

Regards,
Vishwa

Comments

  • xdm
    xdm La Coruña, Spain
    Hi,

    I assume that you are using Ice.Application here, one possibility is that you are using a relative path in "_configName" and the service working directory is not set according. In that case main could throw Ice.FileException when fail to load the config file, that happens before run is called. Here the simple solution will be to use an absolute path for the file, you can also change the server working directory before main is called.

    If that doesn't solve the issue will be good to put a try/catch block in the call to main, to see the exact error from main.
  • Great!

    Fixed the issue related path and that solved it!

    Regards,
    Vishwa