You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
My updates are hosted on IIS and it's protected by client certificate, i.e. client certificate is required to access the updates.
Here is my code that subclassed the WebClient.
public class CertificateWebClient : WebClient
{
private readonly X509Certificate2 certificate;
public CertificateWebClient(X509Certificate2 cert)
{
certificate = cert;
}
protected override WebRequest GetWebRequest(Uri address)
{
HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(address);
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate (Object obj, X509Certificate X509certificate, X509Chain chain, System.Net.Security.SslPolicyErrors errors)
{
return true;
};
}
}
Here is the code does the update
try
{
CertificateWebClient wc = new CertificateWebClient(cert);
FileDownloader fd = new FileDownloader(null);
}
catch (Exception ex)
{
throw ex;
}
I receive an exception at mgr.UpdateApp(), the error message is "The underlying connection was closed: An unexpected error occurred on a send.".
May I ask if I missed something? Much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions