Quantcast
Channel: OPC Labs - OPC Labs - Recent Topics - OPC Labs Online Forums
Viewing all articles
Browse latest Browse all 1794

Read tag values from WCF Service - by: SZL

$
0
0
Hello,

We develop a Windows Service hosted WCF Service that read tag values from OPC server in every minute.
Unfortunately, it's not working, the client throws an exception after 1 minute:

The request channel timed out while waiting for a reply after 00:00:59.7499816. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.

Server stack trace:
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IService1.ReadOPC(String Server, String ProgId, String TagName)
at Service1Client.ReadOPC(String Server, String ProgId, String TagName)

We use this method to read OPC tag value:

WCF Service Interface:

<OperationContract()>
Function ReadOPC(ByVal Server As String, ByVal ProgId As String, ByVal TagName As String) As String

and the implementation:


Public Function ReadOPC(ByVal Server As String, ByVal ProgId As String, ByVal TagName As String) As String Implements IService1.ReadOPC
Try
Using CL As New EasyDAClient()
Return CL.ReadItemValue(Server, ProgId, TagName).ToString()
End Using
Catch ex As Exception
Return ex.Message
End Try
End Function


The service runs with highest Administrator privilege.

For testing, we develop a simple WinForms application with the same code and its working. The application reads the OPC tag value after 1 second.

Do you have any idea what is wrong with the WCF Service version?

Thank you in advance!

Viewing all articles
Browse latest Browse all 1794

Latest Images

Trending Articles



Latest Images