Home Help Center

Windows service and config file

I am having difficulty figuring out how to specifing a config file in a windows service. I am using C#, ICE 3.1 and ssl.
The service works fine when I use a simple TCP setup with no config file and create an adapter with endpoints directly in the code.
In the onstart method of my service I instantiate my server class which is an ICE Application. like...
protected override void OnStart(string[] args)
app = new server();
app.main(args, @c:\test\config.server);

Permissions and access to the file are not the cause.
Can some one give me an example of how to do this, or how to specifiy the ICE properties directly in code eliminating the need for the config file?

Any help greatly appreciated!


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

    You don't mention it in your message, but what exactly is happening when you try to load a configuration file?

    If you want to hard-code the properties in your application, you can do something like this:
    Ice.InitializationData initData = new Ice.InitializationData();
    initData.properties = Ice.Util.createProperties();
    initData.properties.setProperty("MyAdapter.Endpoints", "tcp -p 10000");
    app = new server();
    app.main(args, initData);
    Take care,
    - Mark
Sign In or Register to comment.