Cannot access https url from c# code. trying to access a https://blabla url and access the get method. this is SOAP generated c# class from wsdl. it works from SOAP UI without any problem but doesn't work from the code.i get the error as "Could not create SSL/TLS secure channel"
Could not create SSL/TLS secure channel from soap c# SoapHttpClientProtocol
2.7k views Asked by Isham At
2
There are 2 answers
1
David Grace
On
I'm not sure then, unless the following works. But you mentioned that you already tried setting the SecurityProtocol enum. It might be that your webservice connection expects to be supported with TLS 1.3.
Try the following code and uncomment each line that begins with System.Net.ServicePointManager.SecurityProtocol individually to see if it resolves your issue:
// Uncomment one of these four to see if it works
//System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
//System.Net.ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType)3072;
//System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls13;
//System.Net.ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType)12288;
using (var client = new WebService())
{
data = new JavaScriptSerializer().Deserialize<List<LookupModel>>(client.GetLookupDetails());
TempData["lookupData"] = data;
}
Related Questions in C#
- Passing arguments to main in C using Eclipse
- kernel module does not print packet info
- error C2016 (C requires that a struct or union has at least one member) and structs typedefs
- Drawing with ncurses, sockets and fork
- How to catch delay-import dll errors (missing dll or symbol) in MinGW(-w64)?
- Configured TTL for A record(s) backing CNAME records
- Allocating memory for pointers inside structures in functions
- Finding articulation point of undirected graph by DFS
- C first fgets() is being skipped while the second runs
- C std library don't appear to be linked in object file
- gcc static library compilation
- How to do a case-insensitive string comparison?
- C programming: Create and write 2D array of files as function
- How to read a file then store to array and then print?
- Function timeouts in C and thread
Related Questions in SSL
- How to Fix TLS CBC Incorrect Padding Abuse Vulnerability on Windows 2003 Server
- SSL: Error parsing the certificate: Ok
- PHP mysqlnd sha256_password plugin "Access denied", user works from cli mysql
- CFNetwork SSLHandshake failed iOS 9
- Java does not accept 2 methods with same name
- Expected Compatibility Issues with upcoming TLS/SSL Cipher Suite update on Azure WebApps?
- python requests SSLError
- Connecting via mutual SSL fails reading incoming changeCipherSpec
- HTTP to HTTPS mapping using proxy servers
- Ruby on Windows XP: How to change directory of SSL certificates
- KeyStore file is not found in jar, although present in jar
- How do I accept a self-signed SSL certificate using iOS 7's NSURLSession
- Chef remote_file from https site with self signed certificate
- Meteor force-ssl on a staging system without ssl cert?
- Use python SSL to download google.com.au page
Related Questions in SOAP
- Java - How to send byte array on Soap Request?
- SoapClient in PHP 5.6 when using HTTPS emits warning with "key values mismatch"
- zend soap server reading xml attributes
- Multiple HTTP post requests to a web service from XML files
- Header in SOAPclient PHP
- Namespace for array field in node-soap client (Node.js)
- Generate clients for multiple WSDL files and place it in different package through Spring Gradle
- How pass XML from PHP to the Soap WCF service?
- Jira Soap Api Add Watchers
- java.lang.LinkageError: loader constraint violation when developing a SOAP plugin in JIRA
- Parsing XML with same parent and child node name
- WCF part of soap response body is signed instead of entire body
- Create signature with bouncycastle api. Key always null
- How to convert SOAP-based WCF service to RESTfull API
- Calling method from SOAP returns null
Related Questions in WSDL
- Error with kSOAP2
- Namespace for array field in node-soap client (Node.js)
- Generate clients for multiple WSDL files and place it in different package through Spring Gradle
- How to publish wsdl when using different endpoints in proxy with WSO2?
- Calling Java webservice (wsdl) from VB.net
- JAX-WS WebService via CXF provides inaccurate wsdl
- How to merge two wsdl in a wsdl file?
- Building XSD for secific xml
- SOAP Implementation in Forms Project
- Why does C# Web Client display ? for French Characters?
- Accessing SOAP webservices on https protocol throws Exception SOAP-ERROR: Parsing WSDL
- SOAP Fault: Security requirements are not satisfied because the security header is not present in the incoming message
- How to do authentication using SOAP Header and PHP?
- How to call web services from WSDL?
- Array structure to specify Fedex One Rate using Fedex API RateService
Related Questions in SOAPHTTPCLIENTPROTOCOL
- get the last modification date in a collection within sharepoint application
- adding http headers in call to SoapHttpClient service
- Extending SoapHttpClientProtocol to correct faulty server Content-Length
- Unable to connect to remote server using SoapHttpClientProtocol
- SoapHttpClientProtocol receives unexpected content type
- How to implement a SoapHttpClientProtocol
- C# Passing bearer token to generated proxy class to add header
- How to create persistent Http connection in Java
- Modifying SOAP requests with GetWebRequest
- SoapHttpClientProtocol throws ConnectFailure despite having successfully sent message on WM 6.5 with .NET CF 3.5
- SoapHttpClientProtocol automatically retry after exception?
- Cannot override System.Web.Services.Protocols.SoapHttpClientProtocol to Microsoft.Web.Services2.WebServicesClientProtocol
- How do I configure a C# web service client to send HTTP request header and body in parallel?
- Could not create SSL/TLS secure channel from soap c# SoapHttpClientProtocol
- How to set HTTP Headers from client class inherited from SoapHttpClientProtocol
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
I've had this so many times.
You need to set the
SecurityProtocolbefore executing the method. The HTTP Request you are trying to make expects the request to be sent using Transport Layer Security.To support TLS in your request, use the following code (this sets it to Tls 1.2) before firing the HTTP Request:
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;You can find more information on the different settings from this URL: https://learn.microsoft.com/en-us/dotnet/api/system.net.securityprotocoltype?view=netcore-3.0
If you find that this enum does not exist (because you are using an older version of .NET), you can use the enum integer value from the link above. This example supports Tls 1.2.
System.Net.ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType)3072;