c# - Invoking a SOAP web service: the request was aborted: Could not create SSL/TLS secure channel -


i'm trying invoke soap web service .net application. web services uses https (i got url inside wsdl) can't figure out whether should invoke tls or ssl. here's code:

try {     string soap = "<bigxmlsoapheader></bigxmlsoapheader>"     httpwebrequest request = (httpwebrequest)webrequest.create(ws_uri);     servicepointmanager.servercertificatevalidationcallback = (sender, cert, chain, error) =>     {         return true;     };     byte[] bytes;     bytes = system.text.encoding.ascii.getbytes(soap);     request.contenttype = "text/xml; encoding='utf-8'";     request.timeout = 1000000000;     request.contentlength = bytes.length;     request.method = "post";     stream requeststream = request.getrequeststream(); // fails here     requeststream.write(bytes, 0, bytes.length);     requeststream.close();     httpwebresponse response;     response = (httpwebresponse)request.getresponse();     stream responsestream = response.getresponsestream();     xmltextreader reader = new xmltextreader(responsestream); } catch (exception ex) {   dosomethingwithexception(ex); } 

the exception message the request aborted: not create ssl/tls secure channel.

when copied header (from debugging) , used in soapui invoke web service, worked means there's no problem web service itself.

update: restarted application pool in iis when occured , solved problem. can't find logical explanation this...

please help.


Comments