2 minutes Timeout

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
ggokka
Sr. Member
Sr. Member
Posts: 17
Joined: 03 Jul 2015, 02:34

2 minutes Timeout

Post by ggokka »

All of my opc methods got timeout exception exactly at 2 minutes.

System.TimeoutException was unhandled by user code
HResult=-2146233083
Message=
Source=UnifiedAutomation.UaBase
StackTrace:
위치: UnifiedAutomation.UaBase.AsyncResultBase.ThrowOnError()
위치: UnifiedAutomation.UaBase.AsyncResultBase.WaitForComplete()
위치: UnifiedAutomation.UaBase.AsyncResultBase.WaitForComplete(IAsyncResult ar)
위치: UnifiedAutomation.UaClient.Session.EndCallList(IAsyncResult result)
위치: UnifiedAutomation.UaClient.Session.EndCall(IAsyncResult result, List`1& inputArgumentErrors, List`1& outputArguments)
위치: OpcLatency.OpcClient.OpcClient_OnAsyncCallComplete(IAsyncResult ar)
위치: UnifiedAutomation.UaBase.AsyncResultBase.OperationCompleted()
위치: UnifiedAutomation.UaBase.AsyncResultBase.OnTimeout(Object state)
InnerException:


It seems that unless it take over 2 minutes(120sec) the opc methods works.
So I've tried below lines to expand OperationTimeOut value. But It doesn't work at all

UnifiedAutomation.UaSchema.TransportSettings transportSettings = new UnifiedAutomation.UaSchema.TransportSettings()
{
MaxBufferSize = 65536,
MaxStringLength = 16777216,
MaxByteStringLength = 16777216,
MaxArrayLength = 65536,
MaxMessageSize = 16777216,
OperationTimeout = 360000,
ChannelLifetime = 3600000,
SecurityTokenLifetime = 360000
};
ApplicationInstance.Default.DefaultEndpointConfiguration.Update(transportSettings);

User avatar
Support Team
Hero Member
Hero Member
Posts: 3072
Joined: 18 Mar 2011, 15:09

Re: 2 minutes Timeout

Post by Support Team »

Hello ggokka,

you can just set a property on the Session object:
session.SecureChannelLifetime = 300000;
session.SecureChannelTimeout = 300000;

But it's not a good design to do it this way.
First of all the secure channel has a limited lifetime and is automatically renewed for security reasons (So don't set it to long).
Another problem is that you loose any information about the call when you have a short network interuption.
Look at this sequence:
  • -> Call the method
    -> Server starts working on it
    -> Network interuption
    -> Client gets an error
    -> No way for the client to find out if the method successfully finished on the server. The client doesn't even know if the server started processing the method.
A better approach could be to have an object with a method startOperation() and a variable reflecting the current state and an event the object triggers on completion of the method.
So the client will just call startOperation() and when the method ran to completion the server sends an event to the client. When the call returns the client already knows that the server started processing the method.
When the connection is lost after that the client can read the status variable / variables on the object to update the current state.
Of course that makes it a bit more complex on the client side but with that logic you can "survive" any situation.

Best Regards,
Unified Automation Support Team

Post Reply