INetworkServer LoadDefaultConfiguration() missing

Hello,
I’m updating my project from 8.3.91 to 9.0.97 (my latest version in my subscription). now i’m missing the function of loading the default configuration. Only LoadConfiguration(IServerConfiguration configuration) is available. Where can I add the missing one?
Thanks

Hello,
I’m a little confused. I now installed the version 9.1.91 Trial. And the function LoadConfiguration(IServerConfiguration configuration) is also gone…
Is the documentation https://docs.remotingsdk.com/Servers/Concepts/ServerConfiguration/ wrong?
Thanks for any help!

Hello

This method has been renamed to SetupServer . We’ll update the documentaiton.

The NotworkServer class has been deeply integrated into the Server Boilerplate code that does a lot of server infrastructure management for you: https://docs.remotingsdk.com/Servers/Concepts/ApplicationServerClassNet/

Still if you need to use the NetworkServer directly I can offer a following workaround (it uses some reflection magic and is supposed to be only a workaround until we expose similar method in the Remoting SDK):

Add a new static class with the following code:

static class NetworkServerExtensions
{
	public static void LoadConfiguration(this INetworkServer server)
	{
		INetworkServerConfiguration configuration;

		ServerConfigurationSection configurationSection = ServerConfigurationSection.Instance;
		if (configurationSection != null)
		{
			Type parserType = Type.GetType("RemObjects.SDK.Server.ConfigurationParser, RemObjects.SDK.Server", true);
			Object parser = Activator.CreateInstance(parserType);

			configuration = parserType.GetMethod("Parse").Invoke(parser, new object[] { configurationSection }) as INetworkServerConfiguration;
		}
		else
		{
			Type defaultConfigurationType = Type.GetType("RemObjects.SDK.Server.DefaultNetworkServerConfiguration, RemObjects.SDK.Server", true);
			configuration = Activator.CreateInstance(defaultConfigurationType) as INetworkServerConfiguration;
		}

		server.SetupServer(configuration);
	}
}

Now you can do the following:

class Program
{
	static void Main(string[] args)
	{
		var server = new NetworkServer();

		server.LoadConfiguration();
		server.Start();
		Console.WriteLine("Server started");
		Console.ReadLine();
		server.Stop();
	}
}

The code in the extension method tries to load and parse configuration from the app.config file and if there is no defined it uses the default configuration. Classes are instantiated via reflection because they are internal to Remoting SDK. As I’ve said this is only a workatorung and we’ll expose similar method in the SDK itself for the next Beta / release.

Regards

Thanks for your Answer. This is maybe true for v9.1. I modified it to use it with v9.0. INetworkServerConfiguration and ServerSetup are unknown in v9.0:

static class NetworkServerExtensions
{
    public static void LoadDefaultConfiguration(this INetworkServer server)
    {
        IServerConfiguration configuration;

        ServerConfigurationSection configurationSection = ServerConfigurationSection.Instance;
        if (configurationSection != null)
        {
            Type parserType = Type.GetType("RemObjects.SDK.Server.ConfigurationParser, RemObjects.SDK.Server", true);
            Object parser = Activator.CreateInstance(parserType);

            configuration = parserType.GetMethod("Parse").Invoke(parser, new object[] { configurationSection }) as IServerConfiguration;
        }
        else
        {
            Type defaultConfigurationType = Type.GetType("RemObjects.SDK.Server.DefaultServerConfiguration, RemObjects.SDK.Server", true);
            configuration = Activator.CreateInstance(defaultConfigurationType) as IServerConfiguration;
        }

        server.LoadConfiguration(configuration);
    }
}

An up-to-date and complete documentation would be very helpful! We are using RemObjects SDK since 10 years, but the documentation is getting worse. :anguished:

Regards