Page 1 of 1

Space in discoveryUrl is not syntactically correct.

Posted: 16 Oct 2018, 20:27
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.

Re: Space in discoveryUrl is not syntactically correct.

Posted: 31 Oct 2018, 07:56
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.

Re: Space in discoveryUrl is not syntactically correct.

Posted: 26 Nov 2018, 16:09
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?

Re: Space in discoveryUrl is not syntactically correct.

Posted: 05 Nov 2020, 08:51
by berqo127
Hi,

I encounter the same problem. did anyone solve this?

Thanks,
Shlomi