简体   繁体   English

C#部署我的应用程序 - 仅从Web进行单击

[英]C# Deploying my application - clickonce from web only

So I have developed my application in C#. 所以我用C#开发了我的应用程序。 I am ready to deploy it. 我准备好部署它。 I want to make it so that users always launch it from my website (so that they always get updates, no install, etc.). 我想这样做,以便用户始终从我的网站启动它(这样他们总是得到更新,没有安装等)。

Is ClickOnce the proper way to do this? ClickOnce是正确的方法吗?

I tried deploying ClickOnce to my server and a few things jump out at me: 我尝试将ClickOnce部署到我的服务器上并向我跳出一些东西:

1) The user is given the option to run a setup or launch the .application file - what's the difference? 1)用户可以选择运行设置或启动.application文件 - 有什么区别? Can't it detect this on it's own? 它不能自己检测到这个吗?

2) When I try to "launch" the .application it asks to download it to my computer. 2)当我尝试“启动”.application时,它要求将其下载到我的计算机上。 Anyway to just launch the file straight from the browser? 无论如何只是直接从浏览器启动文件?

3) After I download and run the .application file I get an error with the following message: "Deployment and application do not have matching security zones." 3)下载并运行.application文件后,出现以下消息时出现错误:“部署和应用程序没有匹配的安全区域。”

Yes, ClickOnce suits your needs perfectly. 是的,ClickOnce完全符合您的需求。

  1. The setup.exe , or "bootstrapper" as it's called, is used to install prerequisites such as the .NET Framework and Microsoft Installer, since it is the .NET framework that contains the ClickOnce runtime, which is needed to install your application. setup.exe或称为“bootstrapper”用于安装诸如.NET Framework和Microsoft Installer之类的先决条件,因为它是包含安装应用程序所需的ClickOnce运行时的.NET框架。 The bootstrapper needs to be used only once and only on computers that don't have those prerequisites, after that only the .application file, called the "deployment manifest", is used for updates. 引导程序只需要使用一次,并且只能在没有这些先决条件的计算机上使用,之后只有.application文件(称为“部署清单”)用于更新。 When you publish using ClickOnce, a Publish.htm file is created, which contains some JavaScript code that detects if the user has the prerequisites installed. 使用ClickOnce发布时,会创建一个Publish.htm文件,其中包含一些JavaScript代码,用于检测用户是否已安装必备组件。 If the user doesn't, it presents a button that links to setup.exe , otherwise it present a button which links directly to the .application file. 如果用户没有,则会显示一个链接到setup.exe的按钮,否则会显示一个直接链接到.application文件的按钮。 You can use that page (or create one based on it) to give the shortest possible installation experience for your users. 您可以使用该页面(或基于它创建一个页面)为您的用户提供最短的安装体验。

  2. Either the .NET Framework is not installed on the client's computer (in this case, use the bootstrapper), or your web server is not configured properly, and so does not associate the .application extension with the MIME type of application/x-ms-application . .NET Framework未安装在客户端的计算机上(在这种情况下,使用引导程序),或者您的Web服务器未正确配置,因此不会将.application扩展名与application/x-ms-application的MIME类型相关联application/x-ms-application Create that association to solve the issue. 创建该关联以解决问题。 I also recommend adding some http headers to disable the cache on the deployment manifest, otherwise the user's browser can cache it and it could lead to the user missing updates. 我还建议添加一些http标头来禁用部署清单上的缓存,否则用户的浏览器可以缓存它,这可能导致用户缺少更新。

  3. You cannot download and run the deployment manifest file locally for a ClickOnce installation that was published to a web location, since ClickOnce gives a higher trust level to local installation (such as from the local computer or a network share), but the application manifest points to an installation source on the web, which has a lower trust level, and thus fails. 对于发布到Web位置的ClickOnce安装,您无法在本地下载和运行部署清单文件,因为ClickOnce为本地安装(例如来自本地计算机或网络共享)提供了更高的信任级别,但应用程序清单点到Web上的安装源,它具有较低的信任级别,因此失败。 Once you solve issue 2, this issue will also be resolved. 解决问题2后,此问题也将得到解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM