How to create session with Solace Messaging tcp protocol being in orgnization vpn network.

Shambhu Member Posts: 4

Hi Team,

Session creation is failing while being in organization VPN. so tried with proxy settings as well given in

 but no luck. I tried with multiple debug.

string host = $"tcp://";
string username = "solace-cloud-client";
string vpnname = "solace1sttryout";
string password = "pflxxxxxxxxxxxxxxxxxxxqp";

      SessionProperties sessionProps = new SessionProperties()
         Host = host,
         VPNName = VPNName,
         UserName = UserName,
         Password = Password,
         ReconnectRetries = DefaultReconnectRetries,
         SSLValidateCertificate = false,
         //SSLClientCertificateFile = sslFile
     // Connect to the Solace messaging router
     Console.WriteLine("Connecting as {0}@{1} on {2}...", UserName, VPNName, host);
     using (ISession session = context.CreateSession(sessionProps, null, null))
         ReturnCode returnCode = session.Connect();
         if (returnCode == ReturnCode.SOLCLIENT_OK)
             Console.WriteLine("Session successfully connected.");
             Console.WriteLine("Error connecting, return code: {0}", returnCode);

tried with without proxy and with proxy both failed.

also tried but no luck.

string host = $"tcps://";


  • amackenzie
    amackenzie Member, Employee Posts: 260 Solace Employee

    Can you provide error messages for your various attempts?

  • Shambhu
    Shambhu Member Posts: 4
    edited August 2023 #3

    @amackenzie , thanks for picking up the question, error is as below while debugging in

    Message=Failed to connect session
    at SolaceSystems.Solclient.Utils.Types.Utilities.GuardAgainstFailOrNotReady(ReturnCode returnCode, String message, Boolean includeSdkError, ISolLogger logger)
    at SolaceSystems.Solclient.Messaging.Native.SessionImpl.Connect()
    at Tutorial.TopicPublisher.Run(IContext context, String host) in C:\Users\zzu2kor\git source\ConsoleAppSample\SolaceMessaging\SolaceMessaging\Program.cs:line 86
    at Tutorial.TopicPublisher.Main(String[] args) in C:\Users\zzu2kor\OneDrive - Bosch Group\tryouts\git source\ConsoleAppSample\SolaceMessaging\SolaceMessaging\Program.cs:line 165

    This exception was originally thrown at this call stack:
    [External Code]
    Tutorial.TopicPublisher.Run(SolaceSystems.Solclient.Messaging.IContext, string) in Program.cs
    Tutorial.TopicPublisher.Main(string[]) in Program.cs

    program is taken from

  • Shambhu
    Shambhu Member Posts: 4

    @Aaron @marc @amackenzie , Not getting any solution of the above issue, event I checked in with no firewall setting. And not getting any clue why the session creation is failing. Would be great if you provide as code snippet. The git sample program is giving issue in creating session in debug mode.

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 935 admin

    Hi @Shambhu,

    Unfortunately that error doesn't give us obvious next steps. Have you opened a support ticket yet? They will be able to privately chat about your environment details and find a resolution.

    Sorry I couldn't be more helpful!