diff --git a/SimpleUpdater/FSLib.App.SimpleUpdater/MultiServerUpdater.cs b/SimpleUpdater/FSLib.App.SimpleUpdater/MultiServerUpdater.cs index 5cedd40..7552bd6 100644 --- a/SimpleUpdater/FSLib.App.SimpleUpdater/MultiServerUpdater.cs +++ b/SimpleUpdater/FSLib.App.SimpleUpdater/MultiServerUpdater.cs @@ -79,22 +79,14 @@ bool PeekNextServer() /// protected override void OnError() { - var ex = Context.Exception; - - if (ex is WebException) + if (PeekNextServer()) { - if (PeekNextServer()) - { - Trace.TraceWarning("尝试更新时出现服务器错误,且服务器已遍历完成。"); - } - else - { - Trace.TraceWarning("尝试更新时出现服务器错误。正尝试自动切换至其它的服务器节点。已切换至 " + Context.UpdateDownloadUrl); - base.BeginCheckUpdateInProcess(); - } + Trace.TraceWarning("尝试更新时出现服务器错误。正尝试自动切换至其它的服务器节点。已切换至 " + Context.UpdateDownloadUrl); + base.BeginCheckUpdateInProcess(); } else { + Trace.TraceWarning("尝试更新时出现服务器错误,且服务器已遍历完成。"); base.OnError(); } } diff --git a/SimpleUpdater/FSLib.App.SimpleUpdater/Updater.cs b/SimpleUpdater/FSLib.App.SimpleUpdater/Updater.cs index 5c08e00..cb99e2c 100644 --- a/SimpleUpdater/FSLib.App.SimpleUpdater/Updater.cs +++ b/SimpleUpdater/FSLib.App.SimpleUpdater/Updater.cs @@ -249,6 +249,8 @@ void DownloadUpdateInfoInternal(object sender, RunworkEventArgs e) //等待下载完成 wHandler.WaitOne(); } + if (ex != null) throw ex; + Trace.TraceInformation("服务器返回数据----->" + (data == null ? "" : data.Length.ToString() + "字节")); if (data != null && data.Length > 0x10) { @@ -267,8 +269,6 @@ void DownloadUpdateInfoInternal(object sender, RunworkEventArgs e) throw new ApplicationException("服务器返回了不正确的更新结果"); } - - if (ex != null) throw ex; } e.PostEvent(OnDownloadUpdateInfoFinished); if ((Context.UpdateInfo = XMLSerializeHelper.XmlDeserializeFromString(Context.UpdateInfoTextContent)) == null)