国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

.NET客戶端應(yīng)用程序:.NET應(yīng)用程序更新組件(3)

2024-07-10 13:04:08
字體:
供稿:網(wǎng)友
作者:jamie cool

microsoft corporation

3/4/02

翻譯:李嘉
北京.東方瑞道
2004-6-3

(接上篇)

checking for updates

為更新做檢查

the first thing an application needs to be able to do in order to update itself is figure out when a new update is available. in order to do this an application needs to know three things 1) where to check for updates, 2) when to check for updates and 3) how to check for updates. the application update component uses http for all network communication. this allows it to update applications over the intranet or extranet. thus the ‘where’ to check for updates is simply a url to a well known web server.



為了更新自身,應(yīng)用程序首先需要做的就是弄清楚可使用的更新放在什么地方。為做到這一點,應(yīng)用程序需要知道三件事情:1)到什么地方為更新做檢查;2)什么時候進行更新檢查;3)如何進行更新檢查。應(yīng)用程序更新組件使用http進行所有的網(wǎng)絡(luò)通訊。這就允許通過企業(yè)網(wǎng)或外網(wǎng)來更新應(yīng)用程序。這樣的話進行更新檢查所需要的地址就成了已知的web服務(wù)器的一個url地址。



to address the ‘when’ to check for updates, the .net application updater component creates a thread on component creation which is responsible for checking for updates. this thread will sleep for most of the time, but will wake up at the configured interval to perform an update check. how often the application checks for new updates is dependent on the individual application, but common values range from one hour to one day between update checks. this polling based approach is not appropriate for all applications, for example microsoft money only checks for updates when the user tells them to. in this case, the update poller thread can be disabled and update checks performed on-demand by calling the checkforupdate() method on the updater component.

要獲取何時做更新檢查,.net應(yīng)用程序更新組件在組件生成的基礎(chǔ)上產(chǎn)生一個線程,該線程負責進行更新檢查。該線程在大多數(shù)時間處于休眠狀態(tài),但會在設(shè)置好的間隔蘇醒并實現(xiàn)一次更新檢查。應(yīng)用程序為新的更新所做的檢查的頻率依賴于各應(yīng)用自身。但是進行更新檢查的間隔常用值的范圍一般是從一個小時到幾天。對于所有的應(yīng)用程序,這種輪詢的基本方法并不都合適。比如microsoft money只是在用戶讓它去進行更新檢查時它才去檢查。在這種情況下,更新輪詢線程可被禁用,通過用命令調(diào)用更新組件的checkforupdate()方法來實現(xiàn)更新檢查。



there are several ways to go about the ‘how’ to check for updates:

關(guān)于如何進行更新檢查的方法有如下幾種:

method #1: direct file check – the simplest way to check for updates is to use http to compare the last modified date/time stamp of the application files on the server with that on the client. if the server has newer files, the client knows it’s time to update itself. this is the same way a web browser knows if it needs to re-download an html page or image or whether it can just re-use the one previously downloaded. this is certainly the simplest to administrate. when a new version of the app is available, the administrator simply copies the newer version over the older version on the web server. the problem with this is that the update is not atomic and thus there are potential windows of failure. for example, if an administrator updates the version of the app on the web server while a client was in the middle of downloading the previous update, that client may be left with some files from the previous update and some files from new update. for this reason, using a direct file check is not recommended for any non-trivial applications.

方法一.直接文件檢查----通過檢查來更新最簡單的方法是使用http來比較服務(wù)器和客戶端的應(yīng)用程序的最后的修改日期/時間戳是否一致。如果服務(wù)器上有更新的文件,客戶端就知道是時間更新自己了。對于web瀏覽器來講,也是同樣的道理,它知道是否需要重新下載一個html頁面或圖片還是是否可以重復(fù)使用先前已下載的。 對于管理員來說這當然是最簡單的。當應(yīng)用程序有一個新的版本可用時,管理員簡單的拷貝一個更新的版本來覆蓋web服務(wù)器上的舊版本。這種方法的問題在于更新不是自動進行,由此會出現(xiàn)潛在的失敗窗體。比如,如果管理員在更新web服務(wù)器上的應(yīng)用程序版本,同時有個客戶在下載更新之前的版本,那么這個客戶的計算機上就會既存在更新之前的一些文件,也存在更新之后新版本的一些文件。基于上述原因,對于重要的應(yīng)用程序不提倡使用直接文件檢查來更新。



(未完待續(xù))


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 东港市| 建始县| 兰溪市| 凤山市| 达州市| 遂宁市| 黄浦区| 吴桥县| 武清区| 定陶县| 神木县| 肇东市| 泽库县| 台东市| 遂昌县| 南华县| 红原县| 资兴市| 沙坪坝区| 班玛县| 民乐县| 永昌县| 潢川县| 南京市| 秀山| 普洱| 五家渠市| 小金县| 青河县| 西贡区| 四会市| 米林县| 湖南省| 商河县| 德江县| 寿宁县| 卓尼县| 藁城市| 调兵山市| 泸溪县| 增城市|