Am I using ServerAccess in RO SDK wrong?

When using the ServerAccess object in my RO client (C# / .Net) the server is creating a new session every time. Using the more manual method (below) retains the same session between calls.

mySession = ServerAccess.Instance.Service1.GetSessionValue();
Console.WriteLine(mySession);
mySession = ServerAccess.Instance.Service1.GetSessionValue();
Console.WriteLine(mySession);

var message = new RemObjects.SDK.BinMessage();
var clientChannel = new RemObjects.SDK.WinInetHttpClientChannel();
var service1 = RoServerTest.CoService1.Create(message, clientChannel);
mySession = service1.GetSessionValue();
Console.WriteLine(mySession);
mySession = service1.GetSessionValue();
Console.WriteLine(mySession);

Here is the output:

5F78D272-D848-4062-B159-FB79719AD69A
2595A33B-AEE1-41C9-8F63-801D53D6389A
D85FD248-AD0A-4CEB-AFD6-5BA81389CCB4
D85FD248-AD0A-4CEB-AFD6-5BA81389CCB4

Hello

Both yes and no.

Let me elaborate. Unline the _Intf file the _ServerAccess code is not auto-regenerated. Even more, in most cases it is not intended to be used AS IS but to serve more like a starting point.

F.e. in your case you could change it as follows:

	private readonly IClientChannel _clientChannel;
	private readonly IMessage _message;

	public ServerAccess()
	{
		this._serverUrl = "http://localhost:7099/bin";
		this._clientChannel = ClientChannel.ChannelMatchingTargetUri(this._serverUrl);
		this._message = Message.MessageMatchingTargetUri(this._serverUrl);
	}

and instantiate service proxies as

	public IAdminService AdminService
	{
		get
		{
			//return CoAdminService.Create( this.ServerUrl);
			return CoAdminService.Create(this._message, this._clientChannel);
		}
	}

I’ll log an issue to change the auto-generated ServerAccess file use this approach too.

Regards

Thanks, logged as bugs://81202

bugs://81202 got closed with status fixed.