Page 1 of 1

UnifiedAutomation.UaBase.StatusException: An unexpected error occurred while connecting to the server

Posted: 16 May 2023, 10:07
by aroy@aptean.com
Hi,
I am new in this domain, first time trying to connect to the OPC UA server using a custom OPC UA client developed in .Net Framework 4.5.
I have Licensed version of UA libraries -
UnifiedAutomation.UaBase.dll (Product version 2.5.4.397),
UnifiedAutomation.UaClient.dll (Product version 2.5.4.397)


Problem I am facing - When connecting locally to prosys simulation server, its working fine with Certificate, but not working when trying to connect actual Beckhoff OPC-UA Server.
That server has trusted my client certificate and my client automatically trust the server certificate and save that under the trusted folder, mentioned in my app.config file.

When I am using UAExpert or Prosys Client, they are able to connect with that server successfully.
But why I am getting the error is not clear to me.

Need help from support and experts, please give me at least some hints.
Please let me know if you want more info.

btw, generated certificate using "FullClient.exe".

my client certificate data -
Signature algorithm - sha256RSA
Signature hash algorithm - sha256
Issuer -
CN = OPCUAClient
O = UnifiedAutomation
DC = vax-vs495.sodra.com
Subject-
CN = OPCUAClient
O = UnifiedAutomation
DC = vax-vs495.sodra.com
===========================

Please Note, I am getting the same error if I use certificate OR even if I don't use certificate - in both the cases....

[StatusException]: Failed to Connect => opc.tcp://172.21.150.93:48050 / UnifiedAutomation.UaBase.StatusException: An unexpected error occurred while connecting to the server. ---> UnifiedAutomation.UaBase.StatusException: An unexpected error occurred while connecting to the server.
at UnifiedAutomation.UaBase.TcpAsyncOperation`1.End(Int32 timeout)
at UnifiedAutomation.UaBase.TcpClientChannel.EndSendRequest(IAsyncResult result)
at UnifiedAutomation.UaBase.SessionClient.EndCreateSession(IAsyncResult result, NodeId& sessionId, NodeId& authenticationToken, Double& revisedSessionTimeout, Byte[]& serverNonce, Byte[]& serverCertificate, EndpointDescriptionCollection& serverEndpoints, SignedSoftwareCertificateCollection& serverSoftwareCertificates, SignatureData& serverSignature, UInt32& maxRequestMessageSize)
at UnifiedAutomation.UaClient.Session.OnCreateSessionComplete(IAsyncResult result)
--- End of inner exception stack trace ---
at UnifiedAutomation.UaBase.AsyncResultBase.ThrowOnError()
at UnifiedAutomation.UaBase.AsyncResultBase.WaitForComplete()
at UnifiedAutomation.UaBase.AsyncResultBase.WaitForComplete(IAsyncResult ar)
at UnifiedAutomation.UaClient.Session.EndConnect(IAsyncResult result)
at Axxos.OPCUA.TestConnect.Form1.Connect(Boolean withCertificate) in C:\Users\aroy\source\repos\AXS4_OPC_UA\Axxos.OPCUA.TestConnect\Form1.cs:line 126

Re: UnifiedAutomation.UaBase.StatusException: An unexpected error occurred while connecting to the server

Posted: 16 May 2023, 10:07
by aroy@aptean.com
Trace file-
Timestamp|ThreadId|ModuleId|TraceLevel|Message|Exception

07:13.35|0001|00|0|Log created at 2023-05-16 07:13:35 with TraceLevel Info
07:13.35|0001|00|0|Entry Assembly: Axxos OPCUA Test Connect, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
07:13.35|0001|00|0|Stack Assembly: UnifiedAutomation.UaBase, Version=2.0.0.0, Culture=neutral, PublicKeyToken=90c158e6f23d82c1
07:13.35|0001|01|0|MODULE LOADED [1] UnifiedAutomation.Stack
07:13.35|0001|00|0|***VALID***UaSdkNetClient-2.5.4-Win32-Binary - ClientSDK enabled - Linden Erik - AXXOS Industrial Systems AB -
07:13.35|0001|02|0|MODULE LOADED [2] UnifiedAutomation.Client
07:13.35|0001|01|2|Loaded application settings from app.config.
07:13.35|0001|01|4|Processing Command Line: {C:\Users\kon-supax\Desktop\TestClient_16052023_B\Axxos OPCUA Test Connect.exe}
07:13.35|0001|01|1|ERROR: Overriding ApplicationUri (vax-vs495.sodra.com://vax-vs495/OPCUAClient) with URI from ApplicationCertificate (urn:vax-vs495.sodra.com:OPCUAClient).
07:14.10|0013|01|4|SECURE CHANNEL CREATED [TcpClientChannel UA-TCP 2.0.0.0] [Channel=0/Token=1] Connected To: opc.tcp://172.21.150.93:48050/ [None/None/]
07:14.10|0013|01|4|TCPCLIENTCHANNEL Shutdown Socket=00000590, ChannelId=3229693558, TokenId=1, Reason=[BadSecureChannelClosed]Socket was closed gracefully
07:14.10|0001|01|4|TCPCLIENTCHANNEL Shutdown Socket=00000000, ChannelId=0, TokenId=0, Reason=[BadConnectionClosed]BadConnectionClosed
07:14.10|0001|02|4|CONNECTION STATUS CHANGED: Connecting opc.tcp://172.21.150.93:48050
07:14.10|0012|01|4|SECURE CHANNEL CREATED [TcpClientChannel UA-TCP 2.0.0.0] [Channel=0/Token=1] Connected To: opc.tcp://172.21.150.93:48050/ [None/None/]
07:14.10|0011|01|4|TCPCLIENTCHANNEL Shutdown Socket=0000056C, ChannelId=3229693559, TokenId=1, Reason=[BadSecureChannelClosed]Socket was closed gracefully
07:14.10|0003|01|4|TCPCLIENTCHANNEL Shutdown Socket=00000000, ChannelId=0, TokenId=0, Reason=[BadConnectionClosed]BadConnectionClosed
07:14.10|0003|01|4|Selecting URL for DiscoveryUrl=opc.tcp://172.21.150.93:48050//UseSecurity=False/transportProfileUri=
07:14.10|0003|01|2|Ignoring invalid endpoint returned from server with SecurityPolicyUri=http://opcfoundation.org/UA/SecurityPolicy#Aes128_Sha256_RsaOaep
07:14.10|0003|01|2|Ignoring invalid endpoint returned from server with SecurityPolicyUri=http://opcfoundation.org/UA/SecurityPolicy#Aes256_Sha256_RsaPss
07:14.12|0011|02|1|[BadUnexpectedError] Error during OnCreateSessionComplete.|StatusException|An unexpected error occurred while connecting to the server.
07:14.12|0001|02|1|[BadUnexpectedError] Error during EndConnect.|StatusException|An unexpected error occurred while connecting to the server.
07:14.12|0001|02|4|CONNECTION STATUS CHANGED: Disconnected opc.tcp://172.21.150.93:48050/

Re: UnifiedAutomation.UaBase.StatusException: An unexpected error occurred while connecting to the server

Posted: 16 May 2023, 10:09
by aroy@aptean.com
My client app's app config file -

Code: Select all

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="UaApplicationConfiguration" type="UnifiedAutomation.UaBase.ApplicationConfigurationSection,UnifiedAutomation.UaBase"/>
  </configSections>
  <UaApplicationConfiguration>
    <SecuredApplication xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://opcfoundation.org/UA/2011/03/SecuredApplication.xsd">
	  <ApplicationName>Axxos OPCUA</ApplicationName>
	  <ApplicationUri>vax-vs495.sodra.com:OPCUAClient</ApplicationUri>
      <ApplicationType>Client_1</ApplicationType>
		<ApplicationCertificate>
			<StoreType>Directory</StoreType>
			<StorePath>C:\ProgramData\unifiedautomation\UaSdkNetBundleBinary\pkiclient\issuers</StorePath>
			<SubjectName>CN=OPCUAClient/O=UnifiedAutomation/DC=vax-vs495.sodra.com</SubjectName>
			<ValidationOptions>0</ValidationOptions>
		</ApplicationCertificate>
		<TrustedCertificateStore>
			<StoreType>Directory</StoreType>
			<StorePath>C:\ProgramData\unifiedautomation\UaSdkNetBundleBinary\pkiclient\trusted</StorePath>
			<ValidationOptions>0</ValidationOptions>
		</TrustedCertificateStore>
		<IssuerCertificateStore>
			<StoreType>Directory</StoreType>
			<StorePath>C:\ProgramData\unifiedautomation\UaSdkNetBundleBinary\pkiclient\issuers</StorePath>
			<ValidationOptions>0</ValidationOptions>
		</IssuerCertificateStore>
		<RejectedCertificatesStore>
			<StoreType>Directory</StoreType>
			<StorePath>C:\ProgramData\unifiedautomation\UaSdkNetBundleBinary\pkiclient\rejected</StorePath>
			<ValidationOptions>0</ValidationOptions>
		</RejectedCertificatesStore>
		
      <Extensions>
        <Extension>
          <TraceSettings xmlns="http://unifiedautomation.com/schemas/2011/12/Application.xsd" MasterTraceEnabled="true" DefaultTraceLevel="Info">
            <TraceFile>%CommonApplicationData%\unifiedautomation\logs\UaSdkNetBundle\OPCUAClient_test.log.txt</TraceFile>
            <MaxEntriesPerLog>100000</MaxEntriesPerLog>
            <MaxLogFileBackups>3</MaxLogFileBackups>
            <FastTrace>true</FastTrace>
            <ModuleSettings>
              <ModuleTraceSettings ModuleName="UnifiedAutomation.Stack"/>
              <ModuleTraceSettings ModuleName="UnifiedAutomation.Client"/>
            </ModuleSettings>
          </TraceSettings>
        </Extension>

        <Extension>
          <ClientSettings xmlns="http://unifiedautomation.com/schemas/2011/12/Application.xsd">
            <ProductUri>urn:UnifiedAutomation:OPCUAClient</ProductUri>
          </ClientSettings>
        </Extension>
        <Extension>
          <InstallationSettings xmlns="http://unifiedautomation.com/schemas/2011/12/Application.xsd">
            <GenerateCertificateIfNone>true</GenerateCertificateIfNone>
            <CertificateKeyLength>2048</CertificateKeyLength>
            <CertificateHashAlgorithm>sha256</CertificateHashAlgorithm>
            <DeleteCertificateOnUninstall>true</DeleteCertificateOnUninstall>
          </InstallationSettings>
        </Extension>
      </Extensions>
    </SecuredApplication>
  </UaApplicationConfiguration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>

Re: UnifiedAutomation.UaBase.StatusException: An unexpected error occurred while connecting to the server

Posted: 16 May 2023, 10:11
by aroy@aptean.com
And following is my VERY SIMPLE Connect button click code-

Code: Select all

private void Connect(bool withCertificate = false)
        {
            m_session = new Session(m_applicationInstance);
            m_session.UserIdentity = new UserIdentity();
            
            m_session.UserIdentity.IdentityType = UserIdentityType.Anonymous;
            m_session.InsecureCredentials += OnInsecureCredentials;

            if (m_session != null)
            {
                    List<EndpointDescription> endpoints;
                        using (Discovery discovery = new Discovery())
                        {
                            string discoveryUrl = serverUrl;
                            endpoints = discovery.GetEndpoints(discoveryUrl);
                        }

                    Uri currentUri = new Uri(serverUrl);
                    EndpointDescription currentEndpoint = null;
                    Uri endPointUri;
                        endpoints?.ForEach(x =>
                        {
                            endPointUri = new Uri(x.EndpointUrl);

                            if (endPointUri != null && endPointUri.Port == currentUri?.Port && x.SecurityMode == MessageSecurityMode.None)
                            {
                                logs.Append("3: Matching endpoint => " + endPointUri + "  SecurityMode: " + x.SecurityMode.ToString() + Environment.NewLine);

                                currentEndpoint = x;
                                if ("localhost".Equals(endPointUri.Host))
                                {
                                    logs.Append("3A: endPointUri.Host is localhost..." + Environment.NewLine);
                                    currentEndpoint.EndpointUrl = serverUrl;
                                }
                            }
                        });

                        if (currentEndpoint == null)
                            logs.Append("5: CurrentEndpoint IS NULL." + Environment.NewLine);
                        else
                            logs.Append("5: CurrentEndpoint IS NOT NULL: " + currentEndpoint.EndpointUrl + Environment.NewLine);

                        logs.Append("5A: Going to Connect with: Server URL with NONE security => " + serverUrl + Environment.NewLine);
                        m_session.Connect(serverUrl, SecuritySelection.None);
                        logs.Append("6: Done." + Environment.NewLine);
                }
        }
		
		static void Application_UntrustedCertificate(object sender, UntrustedCertificateEventArgs e)
        {
            e.Accept = true;
            e.Persist = true;
        }

        static void OnInsecureCredentials(Session sender, InsecureCredentialsEventArgs e)
        {
            e.AllowInsecureCredentials = true;
        }

Re: UnifiedAutomation.UaBase.StatusException: An unexpected error occurred while connecting to the server

Posted: 16 May 2023, 12:09
by Support Team
Hi,
Please Note, I am getting the same error if I use certificate OR even if I don't use certificate - in both the cases....
your best option is to look into name resolution. The DiscoveryURL is one side of the story but the EndpointDescription (returned by the server) is the other side of the story (and used for connect). You either have a proper DNS server in your network that can resolve hostnames into IP adresses, or alternatively do the resolve/replacement yourself (use event handler, or let the SDK do it for you, simply check: UseDnsNameAndPortFromDiscoveryUrl).

Re: UnifiedAutomation.UaBase.StatusException: An unexpected error occurred while connecting to the server

Posted: 16 May 2023, 16:34
by aroy@aptean.com
Hi Support Team,

Can you please tell me what should I do with my limited knowledge to resolve this issue?

I tried earlier dns name as server url also, but at that time it was not even able to execute discovery.GetEndpoints.

Please help me to understand the root cause- how UAExpert can able to connect with same config but not my code.

Re: UnifiedAutomation.UaBase.StatusException: An unexpected error occurred while connecting to the server

Posted: 17 May 2023, 07:14
by aroy@aptean.com
Thanks a lot to Support team.
After adding that - UseDnsNameAndPortFromDiscoveryUrl, its working.

Re: UnifiedAutomation.UaBase.StatusException: An unexpected error occurred while connecting to the server

Posted: 17 May 2023, 08:26
by Support Team
Hello,

You are using an outdated version of our sdk. We strongly recommend to update to the latest version.

A likely reason for the issue is that the name resolution is not working. Please try setting UseDnsNameAndPortFromDiscoveryUrl to true before calling Session.Connect.

https://documentation.unified-automation.com/uasdknet/3.3.0/html/classUnifiedAutomation_1_1UaClient_1_1Session.html#a87ab7201de6af976e9f1411de820a1ab

Re: UnifiedAutomation.UaBase.StatusException: An unexpected error occurred while connecting to the server

Posted: 14 Jun 2023, 14:10
by aroy@aptean.com
Another issue I am getting currently when trying to connect with "Sign & Encrypt" mode, with client certificate and usename+password.

Error logs-
2: Discovery.GetEndpoints is done. endpoints count => 1
3: Matching endpoint => opc.tcp://172.21.75.50:49320/ SecurityMode: SignAndEncrypt
4: Endpoint finding is done...
5: CurrentEndpoint IS NOT NULL: opc.tcp://172.21.75.50:49320
5A: Changed UserIdentity to UserName
5A1: Added User Identity (username and password) in current session.
5B: Going to Connect with: Server URL with Best Available security => opc.tcp://172.21.75.50:49320
6: [StatusException]: Failed to Connect => opc.tcp://172.21.75.50:49320 / UnifiedAutomation.UaBase.StatusException: Error received from remote host: An error occurred verifying security. ---> UnifiedAutomation.UaBase.StatusException: Error received from remote host: An error occurred verifying security.
at UnifiedAutomation.UaBase.TcpAsyncOperation`1.End(Int32 timeout)
at UnifiedAutomation.UaBase.TcpClientChannel.EndSendRequest(IAsyncResult result)
at UnifiedAutomation.UaBase.SessionClient.EndCreateSession(IAsyncResult result, NodeId& sessionId, NodeId& authenticationToken, Double& revisedSessionTimeout, Byte[]& serverNonce, Byte[]& serverCertificate, EndpointDescriptionCollection& serverEndpoints, SignedSoftwareCertificateCollection& serverSoftwareCertificates, SignatureData& serverSignature, UInt32& maxRequestMessageSize)
at UnifiedAutomation.UaClient.Session.OnCreateSessionComplete(IAsyncResult result)
--- End of inner exception stack trace ---
at UnifiedAutomation.UaBase.AsyncResultBase.ThrowOnError()
at UnifiedAutomation.UaBase.AsyncResultBase.WaitForComplete()
at UnifiedAutomation.UaBase.AsyncResultBase.WaitForComplete(IAsyncResult ar)
at UnifiedAutomation.UaClient.Session.EndConnect(IAsyncResult result)
at Axxos.OPCUA.TestConnect.Form1.Connect(Boolean withCertificate, Boolean withUser) in C:\Users\aroy\source\repos\AXS4_OPC_UA\Axxos.OPCUA.TestConnect\Form1.cs:line 164

Re: UnifiedAutomation.UaBase.StatusException: An unexpected error occurred while connecting to the server

Posted: 14 Jun 2023, 14:12
by aroy@aptean.com
my code-
==========

private void Connect(bool withCertificate = false, bool withUser = false)
{
MessageSecurityMode securityMode = MessageSecurityMode.None;
logs = new StringBuilder();
textBox4.Text = textBox7.Text = String.Empty;
textBox4.ForeColor = Color.Red;

if (textBox1.Text.Length <= 1)
{
MessageBox.Show("You must enter a OPC-UA server URL", "OPC-UA Server");
return;
}

label13.Visible = true;
string serverUrl = textBox1.Text;
if (!serverUrl.StartsWith("opc.tcp://"))
{
serverUrl = "opc.tcp://" + serverUrl;
}

if(radioSecurityModeSign.Checked)
securityMode = MessageSecurityMode.Sign;
else if (radioButtonSecurityModeSignEncrypt.Checked)
securityMode = MessageSecurityMode.SignAndEncrypt;

m_session = new Session(m_applicationInstance);
m_session.UserIdentity = new UserIdentity();
m_session.UserIdentity.IdentityType = UserIdentityType.Anonymous;
m_session.UseDnsNameAndPortFromDiscoveryUrl = true;

m_session.InsecureCredentials += OnInsecureCredentials;
logs.Append("1: Changed UserIdentity to Anonymous" + Environment.NewLine);

if (m_session != null)
{
try
{
List<EndpointDescription> endpoints;
try
{
// create the object used to find servers or endpoints.
using (Discovery discovery = new Discovery())
{
// This is the opcua server url that is provided on the GUI
string discoveryUrl = serverUrl;
// The GetEndpoints Api makes a call to retrieve the server's certificate
endpoints = discovery.GetEndpoints(discoveryUrl);
}

}
catch(Exception ex)
{
logs.Append("2: Failed in Discovery.GetEndpoints... Stoppong with Error => " + ex.ToString() + Environment.NewLine);
ShowStatus();
return;
}
logs.Append("2: Discovery.GetEndpoints is done. endpoints count => " + endpoints.Count + Environment.NewLine);

Uri currentUri = new Uri(serverUrl);
EndpointDescription currentEndpoint = null;
Uri endPointUri;
try
{
endpoints?.ForEach(x =>
{
endPointUri = new Uri(x.EndpointUrl);

if (endPointUri != null && endPointUri.Port == currentUri?.Port && x.SecurityMode == securityMode)
{
logs.Append("3: Matching endpoint => " + endPointUri + " SecurityMode: " + x.SecurityMode.ToString() + Environment.NewLine);

currentEndpoint = x;
if ("localhost".Equals(endPointUri.Host))
{
logs.Append("3A: endPointUri.Host is localhost..." + Environment.NewLine);
currentEndpoint.EndpointUrl = serverUrl;
}
}
});
}

Re: UnifiedAutomation.UaBase.StatusException: An unexpected error occurred while connecting to the server

Posted: 14 Jun 2023, 14:13
by aroy@aptean.com
catch(Exception ex)
{
logs.Append("3: Failed in Endpoint finding for "+ serverUrl + "... Stoppong with Error => " + ex.ToString() + Environment.NewLine);
ShowStatus();
return;
}
logs.Append("4: Endpoint finding is done..." + Environment.NewLine);


try
{
if (currentEndpoint == null)
logs.Append("5: CurrentEndpoint IS NULL." + Environment.NewLine);
else
logs.Append("5: CurrentEndpoint IS NOT NULL: " + currentEndpoint.EndpointUrl + Environment.NewLine);



if (withUser)
{
if (string.IsNullOrEmpty(textBoxUsername.Text.Trim()) || string.IsNullOrEmpty(textBoxPwd.Text.Trim()))
{
MessageBox.Show("Please enter both Username and Password fields!!");
return;
}
else
{
m_session.UserIdentity = new UserIdentity();
m_session.UserIdentity.IdentityType = UserIdentityType.UserName;
m_session.UserIdentity.UserName = textBoxUsername.Text.Trim();
m_session.UserIdentity.Password = textBoxPwd.Text.Trim();
logs.Append("5A: Changed UserIdentity to UserName" + Environment.NewLine);
logs.Append("5A1: Added User Identity in current session." + Environment.NewLine);
}
}

if (radioNone.Checked)
{
logs.Append("5B: Going to Connect with: Server URL with NONE security => " + serverUrl + Environment.NewLine);
m_session.Connect(serverUrl, SecuritySelection.None);
}
else
{
logs.Append("5B: Going to Connect with: Server URL with Best Available security => " + serverUrl + Environment.NewLine);
m_session.Connect(serverUrl, SecuritySelection.BestAvailable);
}

logs.Append("6: Done." + Environment.NewLine);
}
catch (StatusException exc)
{
logs.Append("6: [StatusException]: Failed to Connect => " + serverUrl + " / " + exc.ToString() + Environment.NewLine);
TryAgain(currentEndpoint);
return;
}
catch (Exception ex)
{
logs.Append("6: [Exception]: Failed to Connect => " + serverUrl + " / " + ex.ToString() + Environment.NewLine);
TryAgain(currentEndpoint);
return;
}

textBox4.ForeColor = Color.Green;
logs.Append("7: Successfully Connected to Server !!!!!!! " + Environment.NewLine);
}
catch (Exception ex)
{
logs.Append("7: Operation Failed => " + ex.ToString() + Environment.NewLine);
}
finally
{
ShowStatus();
}
}
}

Re: UnifiedAutomation.UaBase.StatusException: An unexpected error occurred while connecting to the server

Posted: 14 Jun 2023, 14:13
by aroy@aptean.com
private void TryAgain(EndpointDescription currentEndpoint)
{
logs.Append("6A: Trying again with currentEndpoint..." + currentEndpoint.EndpointUrl + Environment.NewLine);
try
{
if (currentEndpoint != null)
{
m_session.Connect(currentEndpoint, m_session.DefaultRequestSettings);
logs.Append("6: Done." + Environment.NewLine);
}
}
catch (Exception ex)
{
logs.Append("6A: Failed 2nd attempt => " + ex.ToString() + Environment.NewLine);
ShowStatus();
}
finally
{
ShowStatus();
}
}

private void ShowStatus()
{
textBox4.Text = m_session.ConnectionStatus.ToString();
label13.Visible = false;
textBox7.Text = logs.ToString();
}

static void Application_UntrustedCertificate(object sender, UntrustedCertificateEventArgs e)
{
logs.Append("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + Environment.NewLine);
logs.Append("Application_UntrustedCertificate event fired for Server Certificate!!" + Environment.NewLine);
e.Accept = true;
e.Persist = true;
logs.Append("Server Certificate- Issuer Name: " + e.Certificate.IssuerName + Environment.NewLine);
logs.Append("Server Certificate- Application Uri: " + e.Certificate.ApplicationUri + Environment.NewLine);
logs.Append("Server Certificate- Subject Name: " + e.Certificate.SubjectName + Environment.NewLine);
logs.Append("Client added Server Certificate in trust list !!!!!!" + Environment.NewLine);
logs.Append("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + Environment.NewLine);
}

static void OnInsecureCredentials(Session sender, InsecureCredentialsEventArgs e)
{
logs.Append("+++++++++++++++++++++++++++++++++++++" + Environment.NewLine);
logs.Append("OnInsecureCredentials event fired!!" + Environment.NewLine);
e.AllowInsecureCredentials = true;
logs.Append("+++++++++++++++++++++++++++++++++++++" + Environment.NewLine);
}


public Form1(ApplicationInstance applicationInstance)
{
InitializeComponent();
m_applicationInstance = applicationInstance;
m_applicationInstance.UntrustedCertificate += new UntrustedCertificateEventHandler(Application_UntrustedCertificate);
textBox7.Text = "Application started" + Environment.NewLine + Environment.NewLine;
}

Re: UnifiedAutomation.UaBase.StatusException: An unexpected error occurred while connecting to the server

Posted: 15 Jun 2023, 10:52
by aroy@aptean.com
After TRUSTING client certificate in OPCUA Server, now its working !!