Getting error while creating session using OpenTok .Net SDK

With the deprecation of TLS 1.0 support, our .NET SDK customers have experienced a few challenges in configuring support for TLS 1.1 or 1.2. This article can help when you experience errors related to creating sessions. Specifically, when you see this error: 

OpenTokSDK.Exception.OpenTokWebException: Error with request submission 
at OpenTokSDK.Util.HttpClient.DoRequest(String url, Dictionary`2 specificHeaders, Dictionary`2 bodyData) 
at OpenTokSDK.Util.HttpClient.Post(String url, Dictionary`2 headers, Dictionary`2 data) 
at OpenTokSDK.OpenTok.CreateSession(String location, MediaMode mediaMode, ArchiveMode archiveMode)

OR

Object reference not set to an instance of an object. at OpenTokSDK.Util.HttpClient.DoRequest(String url, Dictionary`2 specificHeaders, Dictionary`2 bodyData) 

Sometimes there can also be NullPointerException while creating session due to any of the above exception.

Please follow the below steps:

  1. Make sure you are using our current SDK version as listed here: https://tokbox.com/developer/sdks/dot-net/
  2. Try forcing TLS1.2 using the below code:
    SecurityProtocol = SecurityProtocolType.Tls12  
  3. Servers running on .NET v4.0 need to upgrade their .NET version to 4.6 .NET framework or a more recent version.
  4. Send a request to https://preview.opentok.com/tls-check.json from within your application and check the response you get. You should get 1.2.

You can find these details covered in our another Help Centre article: https://support.tokbox.com/hc/en-us/articles/360000046059-Desupporting-TLS-1-0

If you are still unable to create session, please contact support@tokbox.com.

 

Have more questions? Submit a request