添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I have a question that I already asked on the GitHub forum. Unfortunately I didn't get an answer there and I hope that you can help me here. If I do get an answer in the GitHub forum, I'll name it here. My GitHubPost can be found under the following link:

https://github.com/OPCFoundation/UA-.NETStandard/issues/1139

I will still copy the post from the GitHub forum here if the link no longer works at some point.

I downloaded the OPC UA standard project from github ( https://github.com/OPCFoundation/UA-.NETStandard ). I would like to use the Reference Client there to access a Beckhoff PLC (server). To do this, I opened the project in VS2017 and set the Reference Client as the startup project. Then I started the project with F5. The following window opened:

Reference_Client

If I now specify the IP address and the port of my PLC (as shown above) and then click on "Connect", the client sometimes establishes a connection to the PLC and sometimes I get the following error message:

Error_Message

In about 80% of the cases there is this error message and the client does not connect to the server. In about 20% of the cases a connection to the server is established and I can read and write variables from the server. I didn't change the program and it seems completely arbitrary when the connection can be established and when not. Has anyone ever had a similar problem?

Many thanks in advance.

UPDATE 1: More detailed error message

The following screenshot shows the details of the error message. I have estimated some parts of the storage path.

Detailed_Error_Message

Five years ago the industry decided to eliminate TLS 1.0/1.1 and require TLS 1.2.1.3 to be used. In June this year Microsoft pushed a security update disabling TLS 1.0/1.1 on servers but not clients. So first some server may have the security push and others may not. Clients if the version of TLS is not specified uses the default. The defaults depends on the version of windows, the version of Net that was used to compile, and the IE setting of the user where TLS version can be specified. You can use a sniffer like wireshark or fiddler to determine the TLS version being used. jdweng Oct 12, 2020 at 9:52 Can you connect with any other client, for example the Prosys OPC UA Browser or UaExpert? Jouni Aro Oct 12, 2020 at 12:46 @JouniAro Thanks for your answer. I can connect the PLC to a UaExpert client via OPC UA. It always works reliably. With VS2017, however, I have the problem described in the question. BeclkhoffPLC Oct 12, 2020 at 13:28 Microsoft keeps on changing defaults with each Net release. So the default TLS version in VS2017 is different from VS2019. VS2017 is probably using either TLS 1.1 or TLS 1.2. VS2019 is using TLS 1.3. jdweng Oct 12, 2020 at 13:54

Thanks again for the many answers. I have been able to narrow down the cause of the problem now. I found the tip in the Github forum that you should comment out all security mechanisms:

You modify your code private static void CheckCertificateDomain(ConfiguredEndpoint endpoint) to return true always, and add AutoAcceptUntrustedCertificates true into config of the client. This is just for developing and troubleshooting of course.

Source: Github tip

I did exactly that and then tried to connect again. I no longer receive an error message, but the operating window for OPC UA crashes. VS2017 itself does not crash, only the operating window in which the IP address can be entered and the connection can be established. When I record the network traffic with Wireshark during the crash, it can be seen that the connection (although the operating window has crashed) was successful. Data is exchanged between the client (VS2017) and the server (Beckhoff PLC).

My new approach is now to no longer use this operating window, but to write a new program. I would like to continue using the library I have used so far. The received and sent variables should then be displayed via the console.

Since this no longer has anything to do with my original question, I will make a new post for questions about this program if necessary and then add the link here.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .