Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Read tag values from WCF Service

More
13 Nov 2018 13:31 #6850 by support
Why are you posting three error in case 5)? Were they under different circumstances? Or are they from subsequent runs of the same program, without any further change?

Note: In the very last case, QuickOPC already communicates with the server. It is just that the server returns data with "bad quality" indication. This is how things should work, from our perspective. The reason why the data has bad quality is outside of our scope.

Bets regards

Please Log in or Create an account to join the conversation.

More
13 Nov 2018 12:28 - 13 Nov 2018 12:29 #6849 by SZL
Hello,

Thank you for the fast answer!

1. We call the methods manually with WCF Test Client. Unfortunately, we cannot use the debugger, because we can test only on the production server.

2. OPC Server and the WCF service runs on the same computer, so its local.

3. We already tried this scenario.

4. The ReadItem method also throws the exception.

5. I change the timeout to 45 in CL object. The error messages in this case:

<s:Envelope xmlns:s="schemas.xmlsoap.org/soap/envelope/">
<s:Header />
<s:Body>
<ReadItemOPCResponse xmlns="tempuri.org/">
<ReadItemOPCResult>An OPC operation failure with error code -1073430527 (0xC004C001) occurred, originating from 'OpcLabs.EasyOpcRaw.DataAccess.RawEasyDAClient'. The inner exception contains details about the problem., INNEREXCEPTION: Cannot connect Data Access client (timeout). , STACKTRACE: </ReadItemOPCResult>
</ReadItemOPCResponse>
</s:Body>
</s:Envelope>

<s:Envelope xmlns:s="schemas.xmlsoap.org/soap/envelope/">
<s:Header />
<s:Body>
<ReadItemValueOPCResponse xmlns="tempuri.org/">
<ReadItemValueOPCResult>An OPC operation failure with error code -1073430527 (0xC004C001) occurred, originating from 'OpcLabs.EasyOpcRaw.DataAccess.RawEasyDAClient'. The inner exception contains details about the problem., INNEREXCEPTION: Cannot connect Data Access client (timeout). , STACKTRACE: </ReadItemValueOPCResult>
</ReadItemValueOPCResponse>
</s:Body>
</s:Envelope>

<s:Envelope xmlns:s="schemas.xmlsoap.org/soap/envelope/">
<s:Header />
<s:Body>
<ReadItemOPCResponse xmlns="tempuri.org/">
<ReadItemOPCResult>@2018-11-13T12:18:29.949; CommFailure LimitOk (24)</ReadItemOPCResult>
</ReadItemOPCResponse>
</s:Body>
</s:Envelope>

Thank you for help!

Additional information: The error throws directly after I invoke the method (so not after 45 sec)
Last edit: 13 Nov 2018 12:29 by SZL.

Please Log in or Create an account to join the conversation.

More
13 Nov 2018 10:46 #6848 by support
Hello.

1. In order to be sure that we are investigating the right thing, make sure that the issue is really in QuickOPC - that is, that the operation method (ReadOPC) is indeed called, and the the code makes it into one of the QuickOPC methods. If it is so, the code can be blocked either in the EasyDAClient constructor, or in the ReadItemValue. Use a debugger, or put a logging code before/after every statement in the ReadOPC method, in order to determine with certainty where the code id blocked.

2. Is the OPC server local or remote, relative to the machine where the WCF service with QuickOPC runs?

3. Try to run the service under the same account as that used with your test WinForms application.

4. The ReadItemValue involves more waiting than ReadItem (ReadItemValue waits for good quality which then requires subscriptions and it all gets quite complicated). At least for the test, replace ReadItemValue by ReadItem. The return value is then the DAVtq object, but for tets purpose you can do .ToString() on it as well, although the result will be different.

5. The default timeouts for QuickOPC's OPC-DA operation are all set to 1 minute, which appears to be the same as the timeout you have on the WCF service call. For that reason, t might happen that the WCF service call timeout out just a few moments before the EasyDAClient call would time out; but in that case, we would at least get an exception that would tell us that the timeout is in the Read method. I suggest that in order to become more useful error message, you either prolong the timeout on the WCF service somewhat (at least by 15 seconds), or shorten the timeout on the EasyDAClient operation (e.g. to 45 seconds) - in CL.InstanceParameters.Timeouts.ReadItem .

Best regards
The following user(s) said Thank You: SZL

Please Log in or Create an account to join the conversation.

More
13 Nov 2018 09:25 #6847 by SZL
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!

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.054 seconds