Certificate error in windows service but not in windows forms app

Our hosted windows service is currently broken because the hoster updated the servers to fix the heartbleed issue.

As a workaround, we implemented this kind of functionality in a small windows forms app to test connectivity which succeeded.

public static bool CheckCertificate(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}

public void GetMessages(IEMailProcessor _messageProcessor)
{
/* Create new Pop 3 client /
Aspose.Email.Pop3.Pop3Client _pop3Client = new Aspose.Email.Pop3.Pop3Client(
Host,
Port,
Username,
Password,
new RemoteCertificateValidationCallback(CheckCertificate));

_pop3Client.Timeout = Timeout;
_pop3Client.EnableSsl = true;

/
Login /
_pop3Client.Login(Aspose.Email.Pop3.Pop3Authentication.Auto);

/
Get the pending message count to test connectivity*/
txtResult.Text = string.Format(“Message count {0}”, _pop3Client.GetMessageCount());
}


When we use the above “workaround” code in our windows service, it still doesn’t work with the same certificate error of:

The remote certificate is invalid according to the validation procedure

Why would this code work in a windows forms app but not in a windows service?


Hi Dominic,


Thank you for writing to Aspose support team.

Could you please share your sample service application that is not working with the change? There is no such known issue till yet where we have faced similar problem and putting the certificate validation as specified in this article works fine for us. We’ll investigate this issue in light of the details shared by you and assist you further accordingly.

Hi,

After more debugging we found a human error mistake. It does work exactly the same in a Windows Service.

Thanks.

Hi Dominic,

We are glad to know that your issue is resolved. Please feel free to write us if you have any other query related to Aspose.Email.

The error is happening with me as well as I am also not being able to access the Windows services as the certificate error is being done and it is also happening because of the Microsoft compatibility telemetry high disk and it has to be rectified thoroughly.

@chrisnolan1221,

Could you please share your sample service application that is not working so that we may further investigate to help you out.