Quantcast
Channel: CSharp Forum Latest Questions
Viewing all articles
Browse latest Browse all 32057

System.IO.IOException: Authentication failed because the rem

$
0
0

I'm creating a webservice ( in .NET 3.5) to obtain SSL certificate information of a remote server based on the domain name and i have a client which is a console application to call the service. presently for me there are 11 domain names. i am able to obtain the SSL information for all server except one.

my code is:

 using (TcpClient client =newTcpClient()){
        client.Connect(strDNSEntry,443);SslStream ssl =newSslStream(client.GetStream(),false);try{
            ssl.AuthenticateAsClient(strDNSEntry);//Error thrown here}catch(AuthenticationException e){
            log.Debug(e.Message);
            ssl.Close();
            client.Close();return cert;}catch(Exception e){
            log.Debug(e.Message);
            ssl.Close();
            client.Close();return cert;}
        cert =new X509Certificate2(ssl.RemoteCertificate);
        ssl.Close();
        client.Close();return cert;}

the error is

"[System.IO.IOException] = {"Authentication failed because the remote party has closed the transport stream."}".

When I examined during debugging at SSLStream I found the error as "

This operation is only allowed using a successfully authenticated context".

Is that because I don't have enough credentials is it throwing the error or any issues with the service? Also I tried to do Remote desktop conncetion to that server, I'm unable to coonect.



Viewing all articles
Browse latest Browse all 32057

Trending Articles