# SSL Connect Error

**URL:** <https://community.solace.com/t/ssl-connect-error/4272>\
**Category:** Solace Event Broker\
**Created:** [May 15, 2025, 2:59am UTC](https://community.solace.com/t/ssl-connect-error/4272 "2025-05-15T02:59:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bxb](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/bxb/32/240_2.png) [@bxb](https://community.solace.com/u/bxb)\
**Post date:** [May 15, 2025, 2:59am UTC](https://community.solace.com/t/ssl-connect-error/4272/1 "2025-05-15T02:59:00Z")

</div>

Development language: .NET C#，  
ISession session = context.CreateSession(sessionProps, null, null)  
result： Failed to create session  
code：  
SessionProperties sessionProps = new SessionProperties()  
{  
Host = “tcps://solace-test.zjhwmy.com.cn:55443”, //host,//“smfs://solace-test.zjhwmy.com.cn:55443”,  
VPNName = vpnnane, //“Preprod”,  
UserName = username, //“test-user-mes”,  
Password = password, //“Aa112211”,  
ReconnectRetries = DefaultReconnectRetries,  
// Option to disbale validating of certificate  
SSLValidateCertificate = true,

};  
ISession session = context.CreateSession(sessionProps, null, null)；

---

<div class="post-metadata">

**Author:** ![Solly-AI](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/solly-ai/32/2305_2.png) [@Solly-AI](https://community.solace.com/u/Solly-AI)\
**Post date:** [May 15, 2025, 2:59am UTC](https://community.solace.com/t/ssl-connect-error/4272/2 "2025-05-15T02:59:23Z")

</div>

**Hi there, I’m Solly AI, I generate responses to your questions using the power of the [Solace Agent Mesh](https://github.com/SolaceLabs/solace-agent-mesh)**:

**Please remember that AI technology can make mistakes so ensure that you read our [Disclaimer](https://docs.solace.com/docs-ai-disclaimer.htm).**

**AI Generated responses are a work in progress, your help in evaluating my response would be awesome! If my response makes sense, please mark it as a solution or give a 👍. If my response doesn’t make sense for your topic, please react to it with a 🫨.**

Looking at the documentation and community discussions, here’s how to resolve the session creation failure:

The error is likely related to SSL/TLS certificate validation when connecting to a secured port. There are two main approaches to resolve this:

1. Disable certificate validation (less secure, but simpler):

```markdown
SessionProperties sessionProps = new SessionProperties() {
    Host = host,
    VPNName = vpnName,
    UserName = userName,
    Password = password,
    SSLValidateCertificate = false
};

```

1. Configure proper certificate validation by loading certificates from the system certificate store:

```markdown
SessionProperties sessionProps = new SessionProperties() {
    Host = host,
    VPNName = vpnName,
    UserName = userName,
    Password = password,
    SSLTrustStore = certificatesCollection // Collection of trusted certificates
};

```

Additional considerations:

- Make sure you’re using the correct secure port (55443) for TCPS connections
- Set appropriate reconnect properties if needed:
  - ReconnectRetries
  - ConnectRetriesPerHost
  - ConnectTimeoutInMsecs

Relevant documentation:

- [C# .net integration getting error Failed to create session](https://community.solace.com/t/c-net-integration-getting-error-failed-to-create-session/511)
- [Handling failures of ISession.Connect with .NET API](https://community.solace.com/t/handling-failures-of-isession-connect-with-net-api/371)

---

<div class="post-metadata">

**Author:** ![bxb](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/bxb/32/240_2.png) [@bxb](https://community.solace.com/u/bxb)\
**Post date:** [May 15, 2025, 3:43am UTC](https://community.solace.com/t/ssl-connect-error/4272/3 "2025-05-15T03:43:02Z")

</div>

modify code：  
SessionProperties sessionProps = new SessionProperties()  
{  
Host = “tcps://solace-test.zjhwmy.com.cn:55443”, //host,//“smfs://solace-test.zjhwmy.com.cn:55443”,  
VPNName = vpnnane, //“Preprod”,  
UserName = username, //“test-user-mes”,  
Password = password, //“Aa112211”,  
ReconnectRetries = DefaultReconnectRetries,  
// Option to disbale validating of certificate  
SSLValidateCertificate = false,

};  
SolaceSystems.Solclient.Messaging.ISession session = context.CreateSession(sessionProps, null, null)；  
ReturnCode returnCode = session.Connect();  
result：Failed to connect session

---

<div class="post-metadata">

**Author:** ![yangsen](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/yangsen/32/463_2.png) [@yangsen](https://community.solace.com/u/yangsen)\
**Post date:** [May 15, 2025, 7:06am UTC](https://community.solace.com/t/ssl-connect-error/4272/4 "2025-05-15T07:06:46Z")

</div>

You need to specify the SSL Trust Store location

```auto
Host = “tcps://solace-test.zjhwmy.com.cn:55443”, 
VPNName = vpnnane, //“Preprod”,
UserName = username, //“test-user-mes”,
Password = password, //“Aa112211”,
ReconnectRetries = DefaultReconnectRetries,
// Option to disbale validating of certificate
SSLValidateCertificate = false,
//specify the SSL Trust Store location, for example
SSLTrustStoreDir = AppDomain.CurrentDomain.BaseDirectory

```

In this case, you should put the trust store in the same directory as your application
