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.

Exception thrown: 'OpcLabs.EasyOpc.UA.OperationModel.UAException' in mscorlib.dl

More
05 Jun 2021 08:59 #9735 by support
I was trying to determine more about the error - it could be that QuickOPC does not trust the OPC server, or the other way round, or something else.
And in order to do that, I need to know what is the details of the exception that QuickOPC is actually throwing from one of its methods, because, even if the exception you reported is at the origin of it, the upper level of QuickOPC provide additional information and context, and from that I hope to get the better understanding.

OPC operation exceptions cannot be prevented with 100% certainty from the user code. Therefore, the app code must contain proper exception handling. If it crashes on exceptions like this, most likely the error handling is either missing or is incorrect. For example, if there was a proper handling, and you were doing operations like Read or Write, there would be a try/catch block around that call, catching the UAException. And it would be possible to set a breakpoint there, and obtain the details of the error I need. And the handling would prevent the app from crashing. Is there such error handling in your code? If so, can you post the relevant piece of code here?

Regards

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

More
03 Jun 2021 19:40 #9733 by hcvoort
Ok, I understand I do not need to worry about all exceptions but it still crashes my app.
Isn't the last output window dump saying that Quick OPC is not trusting the OPC server?

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

More
03 Jun 2021 19:20 #9732 by support
I have problems with this. QuickOPC does never throw such an exception; it only wraps it (or return as a value of property, in event arguments/operation results).

Are you saying that you see this exception in the try/catch block? If so, please post the code here so that I can understand what is it that you are referring to.

Or is it just that you have instructed the debugger to break on this type of exception? Unless you want to dig into a larger problem, you should not really be concerned about every exception thrown - only about those that make it out of the QuickOPC method calls.

Regards

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

More
03 Jun 2021 19:16 #9731 by hcvoort
It also throws this in the output window:

Exception thrown: 'Opc.Ua.ServiceResultException' in Opc.Ua.Core.dll
Certificate is not trusted.
SubjectName: CN=TcOpcUaServer@DESKTOP-SDTDCRD, OU=Unit, O=Organization, L=LocationName, C=DE, DC=DESKTOP-SDTDCRD
IssuerName: CN=TcOpcUaServer@DESKTOP-SDTDCRD, OU=Unit, O=Organization, L=LocationName, C=DE, DC=DESKTOP-SDTDCRD

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

More
03 Jun 2021 19:14 #9730 by hcvoort
I do read/writes and subscriptions. read/writes have try catch blockes, subscriptions not.

I am getting this as details:

Opc.Ua.ServiceResultException
HResult=0x80131500
Message=BadSecureChannelClosed
Source=Opc.Ua.Core
StackTrace:
at Opc.Ua.Bindings.TcpAsyncOperation`1.End(Int32 timeout)

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

More
03 Jun 2021 19:09 #9729 by support
Hello. I need some more information.

What you are reporting is basically an "innermost" exception. QuickOPC should catch it and add some texts and diagnostics to it. Can you catch/breaon on the OpcLabs.EasyOpc.UA.OperationModel.UAException instead, and report its full message text?

Also, is you application doing OPC read/writes, or subscriptions? Is there any error handling code, or do you get a "full-blown" app crash with any exception?

Thank you

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

More
03 Jun 2021 19:00 #9728 by hcvoort
Ok, good to hear :-)
The certificate is now in the trusted certificates with th OPC UA server. Now I am running in this exception:

Exception thrown: 'Opc.Ua.ServiceResultException' in Opc.Ua.Core.dll

Additional information: BadSecureChannelClosed

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

More
03 Jun 2021 18:53 #9727 by support
Thanks for update, I think we are making progress.

What you report now is quite common, if not even "normal": In OPC UA (unless security is turned off), the server needs to trust the client, and the client needs to trust the server. The error you have now can be caused by any of the two; which one it is would be apparent from the full exception message/details.

But, since you have renewed your client certificate, it is likely that it is the server side that now does not trust you. OPC UA servers typically have a dialog where you will find the now-rejected new client certificate, and explicitly make it trusted.

Best regards

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

More
03 Jun 2021 18:44 #9726 by hcvoort
Hello,

Thank you for the extensive feedback! I removed the certificates as you described an ran the executable with elevated rights. I can see a new certificate being created, but I still get an exception:
Exception thrown: 'Opc.Ua.ServiceResultException' in Opc.Ua.Core.dll

Additional information: Certificate is not trusted.

Also visual studio says threadpool.cs not found.

Could you point me further on this search?

Regards

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

More
03 Jun 2021 14:37 #9725 by support
Hello,

thank you, this is helpful. Our customers have reported the error ("The specified network password is not correct.") already, but we were never able to reproduce it on our side, and therefore we do not know yet what the root cause is.

Likely, there is something wrong with the client application certificate created for the client application. This has helped in some instances, please try it out:

1. Download and install UA Configuration Tool .
2. Run it.
3. Switch to the "Manage Certificates" tab.
4. Make sure that "Store Type" is set to Directory.
5. In the "Store Path", drop-down the list, and select the path ending with "Machine Default". The, press the "View Certificates" button. This is the store for the instance certificates of the UA apps on this computer. If you can afford that, delete all of them (right-click and choose "Delete"), or at least delete those that correspond to the apps that have the problem.
6. Restart your application, making sure it is done under elevated privileges (so that it has write access to the stores). This should re-create the app certificate and store it where it belongs to - if that was the cause of the problem.

In step 5, if you can only afford to delete specific certificate, the name of the certificate you need to delete will contain the name of your application, which is construed from info such as your main assembly properties - so hopefully you will recognize which is the right one.

Best regards

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

Moderators: support
Time to create page: 0.074 seconds