I have an updater application that is being started when an update is available. This application is simply downloading a new exe to a specified path, but suddenly it is not working anymore. The updater downloads the file with a size of 0kb and does not give any error.
I had uploaded the new exe to the server 2 months ago and many clients downloaded the file successfully. Yesterday, one of my clients noticed when he started working with the application and the update failed. The updater is running on many clients and worked always. Could it be a server issue?
Here is the updater code in C#:
public void StartUpdate()
{
WebClient webclient = new WebClient();
try
{
//webclient.DownloadFile("http://www.example.nl/folder/example.exe", @"C:\example\example.exe");
webclient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(webclient_DownloadProgressChanged);
webclient.DownloadFileCompleted += new AsyncCompletedEventHandler(webclient_DownloadFileCompleted);
webclient.DownloadFileAsync(new Uri("http://www.example.nl/folder/example.exe"), @"C:\example\example.exe");
}
catch (Exception)
{
MessageBox.Show("Download Failed.\n\nPlease contact your system administrator");
Application.Exit();
}
}
void webclient_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
label1.Text = "Download successfully!";
label3.Text = "Download complete!";
timer2.Enabled = true; //here some other magic happens like start the program and exit this updater.
}
void webclient_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
progressBar1.Maximum = (int)e.TotalBytesToReceive / 100;
progressBar1.Value = (int)e.BytesReceived / 100;
}
I am running Apache on CentOS where the exe file is stored. Folder/file permission are okay. When I open the exe URL in any browser, the file is being downloaded successfully. I never change the exe file within the past 2 months nor any other settings on the webserver. This method worked for 2 years and now it automatically stopped working.
UPDATE:
System.Net.WebException: The request has been aborted: Cannot create a secure SSL / TLS channel.
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult)
at System.Net.WebClient.GetWebResponse (WebRequest request, IAsyncResult result)
at System.Net.WebClient.DownloadBitsResponseCallback (IAsyncResult result) A first chance exception or type 'System.ComponentModel.Win32Exception' occurred in System.dll