I have gotten a sample OPC-UA Client (GettingStartedClient) and Server (UADemoServer.Net48) working but I am trying to allow a user of my Server test application a specific workflow.
- start windows application
- configure server port
- start server
- oops wrong port
- stop server from operating at original port, this frees the original port to be used by some other windows application
- reconfigure port
- start server on correct port
- OPC clients now connect correctly
All without restarting the windows form application.
I am not using the app.config file but instead using a method based on ConfigureOpcUaApplicationFromCode from sample code, Lesson01.
The problem is that I can not see a way to shutdown the server port and change to a new port. There is ApplicationInstanceBase.Start() but I can find no corresponding ApplicationInstanceBase.Stop().
- as far as I can tell these two lines in ConfigurationInMemory set up the port but I can not stop the original service / changes these once started.
configuration.BaseAddresses = New UnifiedAutomation.UaSchema.ListOfBaseAddresses()
configuration.BaseAddresses.Add("opc.tcp://localhost:48030")
The desired workflow can be worked out on the client. Although the Client has the same issue with ApplicationInstanceBase, you can disconnect and dispose of a Session and provide the port on Session.Connect so the necessary workflow appears available on the client.
related question - if I start the ApplicationInstance with Tracing disabled (TraceSettings.MasterTraceEnabled = false), I would also like to enable tracing without restarting the server, is this possible?
related question - if I start the ApplicationInstance with Tracing disabled, I would also like to enable tracing without restarting the Client, is this possible?
Thanks for your help.
Changing OPC Server (and Client) Configuration without Application Restart
Moderator: uasdknet
-
- Jr. Member
- Posts: 1
- Joined: 02 Aug 2023, 16:14
- Support Team
- Hero Member
- Posts: 2976
- Joined: 18 Mar 2011, 15:09
Re: Changing OPC Server (and Client) Configuration without Application Restart
Hello,
You can update the server ports by doing the following steps:
You can update the server ports by doing the following steps:
- Update the BaseAddresses in the configuration
- Call ServerManager.Stop();
- Call ApplicationInstanceBase.Start();
- Call ServerManager.Start(application);
Best regards
Unified Automation Support Team
Unified Automation Support Team