Space in discoveryUrl is not syntactically correct.

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

Moderator: uasdknet

Post Reply
cmcnally447
Jr. Member
Jr. Member
Posts: 2
Joined: 16 Oct 2018, 20:16

Space in discoveryUrl is not syntactically correct.

Post by cmcnally447 »

Hello,
I am having a problem connecting to my OPCUA server. When I connect I get an error of: "The discoveryUrl url must be a syntatically valid URL."
My discoveryUrl is: "opc.tcp://H1002496-01:4880/CM100 OpcUa". I have tried removing the space and the error become a generic one about not finding the server. I have tried to use the following workaround by using ASCII:

Code: Select all

char space = (char)32;
test_session.Connect("opc.tcp://H1002496-01:4880/CM100" + space + "OpcUa", SecuritySelection.None);
How can I have a valid discoveryUrl with a space in it?

EDIT: it's worth noting that I've tried the original string, with a space, in UAExpert and it works fine.

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

Re: Space in discoveryUrl is not syntactically correct.

Post by Support Team »

Hello,

The discoveryUrl must be a syntactically correct Uri. Otherwise it is rejected by the sdk.
Please call Uri.EscapeUriString and pass the returned string to the Connect method.
Best regards
Unified Automation Support Team

cmcnally447
Jr. Member
Jr. Member
Posts: 2
Joined: 16 Oct 2018, 20:16

Re: Space in discoveryUrl is not syntactically correct.

Post by cmcnally447 »

I tried Uri.EscapeString but I still got the same error message.

Code: Select all

// Connect to the server with no security
            char space = (char)32;
            string real_uri = Uri.EscapeUriString("opc.tcp://localhost:4880/CM100" + space + "OpcUa");
            CM100Session.Connect(real_uri, SecuritySelection.None);
Is there anything else I can do to have the string be accepted?

berqo127
Full Member
Full Member
Posts: 5
Joined: 05 Nov 2020, 08:49

Re: Space in discoveryUrl is not syntactically correct.

Post by berqo127 »

Hi,

I encounter the same problem. did anyone solve this?

Thanks,
Shlomi

Post Reply