自动检查我的应用程序的新版本 [英] Automatically checking for a new version of my application

查看:111
本文介绍了自动检查我的应用程序的新版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了满足客户的功能要求,我希望我的应用程序(如果有Internet)可以在我们的网站上查看是否有新版本。



问题是我不知道在服务器端需要做什么。



我可以想象,我的应用程序(在C ++中使用Qt开发)向服务器发送请求(HTTP?),但是什么将响应此请求?为了通过防火墙,我想我必须使用端口80?这是正确的吗?



或者,对于这样的功能,我必须要求我们的网络管理员打开一个特定的端口号,我将通过它进行通信? >




@ pilif :感谢您的详细答复。仍然有一些对我不清楚的地方:



<$>

c $ c> http://www.example.com/update?version=1.2.4



然后,您可以返回


如何传回内容?它会是一个php或asp页面(我不知道PHP或ASP,我不得不承认)?如何解码?version = 1.2.4 部分,以便返回相应的东西?

解决方案

我绝对建议只是做一个简单的HTTP请求到您的网站。一切都会失败。



我会对您网站上包含本地应用程序版本的某个网页发出HTTP GET请求。



like

  http://www.example.com/update?version=1.2 .4 

然后你可以返回你想要什么,也可以返回安装程序的下载URL新版本。



为什么不把一个带有最新版本的静态文件放到服务器上,让客户决定?因为你可能想要(或需要)控制过程。也许1.2将不会与服务器在将来兼容,所以你希望服务器强制更新为1.3,但从1.2.4到1.2.6的更新可能是不重要的,所以你可能想要呈现客户端一个可选的更新。



或者你想对已安装的基础进行细分。



通常,我学会了在服务器上保持尽可能多的智能,因为服务器是你最终控制的。



在这里讲一点经验在这个领域,这里是一个小预览,可以(并且会信任我)错误:




  • 您的申请将被阻止HTTP - 各种个人防火墙应用程序的请求。

  • 相当比例的用户没有必要的权限来实际更新过程。

  • 即使您的用户允许旧版本通过他们的个人防火墙,说该工具会抱怨,因为.EXE已更改,并建议用户不要允许新的EXE连接(用户通常符合他们的愿望

  • 在托管环境中,您将被从网络加载可执行内容并进行挂起(不一定按照顺序),然​​后实际执行它。



为了尽可能减少损害,




    <在更新前无法连接到更新服务器
  • 时,请确保您对安装目录具有写入权限,如果您没有,则警告用户,



  • $ b

    这是没有乐趣,做你正在做什么 - 特别是当你处理非技术倾向的用户,因为我不得不多次。


    Trying to honor a feature request from our customers, I'd like that my application, when Internet is available, check on our website if a new version is available.

    The problem is that I have no idea about what have to be done on the server side.

    I can imagine that my application (developped in C++ using Qt) has to send a request (HTTP ?) to the server, but what is going to respond to this request ? In order to go through firewalls, I guess I'll have to use port 80 ? Is this correct ?

    Or, for such a feature, do I have to ask our network admin to open a specific port number through which I'll communicate ?


    @pilif : thanks for your detailed answer. There is still something which is unclear for me :

    like

    http://www.example.com/update?version=1.2.4

    Then you can return what ever you want, probably also the download-URL of the installer of the new version.

    How do I return something ? Will it be a php or asp page (I know nothing about PHP nor ASP, I have to confess) ? How can I decode the ?version=1.2.4 part in order to return something accordingly ?

    解决方案

    I would absolutely recommend to just do a plain HTTP request to your website. Everything else is bound to fail.

    I'd make a HTTP GET request to a certain page on your site containing the version of the local application.

    like

    http://www.example.com/update?version=1.2.4
    

    Then you can return what ever you want, probably also the download-URL of the installer of the new version.

    Why not just put a static file with the latest version to the server and let the client decide? Because you may want (or need) to have control over the process. Maybe 1.2 won't be compatible with the server in the future, so you want the server to force the update to 1.3, but the update from 1.2.4 to 1.2.6 could be uncritical, so you might want to present the client with an optional update.

    Or you want to have a breakdown over the installed base.

    Or whatever. Usually, I've learned it's best to keep as much intelligence on the server, because the server is what you have ultimate control over.

    Speaking here with a bit of experience in the field, here's a small preview of what can (and will - trust me) go wrong:

    • Your Application will be prevented from making HTTP-Requests by the various Personal Firewall applications out there.
    • A considerable percentage of users won't have the needed permissions to actually get the update process going.
    • Even if your users have allowed the old version past their personal firewall, said tool will complain because the .EXE has changed and will recommend the user not to allow the new exe to connect (users usually comply with the wishes of their security tool here).
    • In managed environments, you'll be shot and hanged (not necessarily in that order) for loading executable content from the web and then actually executing it.

    So to keep the damage as low as possible,

    • fail silently when you can't connect to the update server
    • before updating, make sure that you have write-permission to the install directory and warn the user if you do not, or just don't update at all.
    • Provide a way for administrators to turn the auto-update off.

    It's no fun to do what you are about to do - especially when you deal with non technically inclined users as I had to numerous times.

    这篇关于自动检查我的应用程序的新版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆