简体   繁体   English

加速ClickOnce应用程序启动的方法

[英]Ways to speed up the startup of a ClickOnce application

I have a Visual Studio 2005/ C# ClickOnce application that gets all its data from a Web service . 我有一个Visual Studio 2005 / C# ClickOnce应用程序,它从Web服务获取所有数据。 I've gotten the application tuned where it feels pretty snappy to the users, even though it has to go and fetch data from the Web service for almost everything. 我已经将应用程序调整到了对用户来说非常活泼的地方,即使它必须从Web服务获取几乎所有内容的数据。

However, the startup is still pretty sluggish. 然而,创业公司仍然相当迟钝。 It seems like it takes a while to generate the first web service call. 似乎需要一段时间才能生成第一个Web服务调用。 After that, it's fine. 在那之后,没关系。

What can I do to speed up the startup of this type of an application? 我该怎么做才能加速这类应用程序的启动? Do I need to generate a serialization assembly? 我需要生成序列化程序集吗?

Spend some time analyzing the assemblies loaded by your application. 花一些时间分析应用程序加载的程序集。 That's going to have the greatest effect on the load time of your application. 这将对您的应用程序的加载时间产生最大的影响。 If you have types that are only used on occasion, move them to another assembly. 如果您的类型仅在有时使用,请将它们移动到另一个组件。 ClickOnce can optimize the download of assemblies on demand so reducing the required number of assemblies at load time will make it load faster. ClickOnce可以根据需要优化组件下载,因此在加载时减少所需的组件数量将使其加载更快。

You can also have a sort of "stub" launcher with bare minimum assembly dependencies that loads the other assemblies dynamically (Assembly.Load) and invokes the real processing after they are loaded. 您还可以使用一种“stub”启动程序,它具有最小的程序集依赖性,可以动态加载其他程序集(Assembly.Load),并在加载后调用实际处理。

You can use ClickOnce file groups to split your application into manageable pieces and then use the ClickOnce API to download groups when needed. 您可以使用ClickOnce文件组将应用程序拆分为可管理的部分,然后在需要时使用ClickOnce API下载组。 The article ClickOnce File Groups explains how to do this. 文章ClickOnce文件组解释了如何执行此操作。

Make sure you get .NET 3.5 SP1 as there are significant performance improvements in the area of startup. 确保您获得.NET 3.5 SP1,因为在启动方面有显着的性能改进。 Particularly with WPF applications. 特别是WPF应用程序。

And as for the web service call, you can speed that up if you make sure you generate a serialization assembly when you compile. 至于Web服务调用,如果确保在编译时生成序列化程序集,则可以加快速度。 From what I can remember, Visual Studio is not very smart about knowing when to generate this file automatically but you can do it with SGEN.EXE. 根据我的记忆,Visual Studio不知道何时自动生成此文件,但您可以使用SGEN.EXE。

It create a separate assembly such as MyApp.XmlSerializer.dll which contains all the serialization code for the web service call. 它创建一个单独的程序集,如MyApp.XmlSerializer.dll,其中包含Web服务调用的所有序列化代码。 Without this, your app will do a failed probe for the assembly then dynamically generate the code and compile it in-memory which is why your first web service call is slow. 如果没有这个,您的应用程序将对程序集执行失败的探测,然后动态生成代码并在内存中编译它,这就是您的第一个Web服务调用很慢的原因。

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

相关问题 使用ClickOnce应用程序创建启动文件夹shorcut? - Creating a startup folder shorcut with a ClickOnce application? 是否在Windows启动时强制ClickOnce应用程序更新? - Forcing ClickOnce application update on Windows Startup? 更新后Clickonce Winforms应用程序启动缓慢 - Slow startup of Clickonce winforms application after update 调试ClickOnce应用程序并传递启动命令参数 - Debugging a ClickOnce application and passing startup command parameters 使用ClickOnce部署启动缓慢的应用程序 - Slow application startup using ClickOnce deployment 如何在Windows启动时启动最小化的ClickOnce应用程序? - How to start minimized ClickOnce application on Windows startup? 如果在应用程序启动时创建和播种大约 120k 的记录,有什么方法可以加快应用程序的响应时间? - Is there any way to speed up the response time of the application if it is creating and seeding around 120k of records on the application startup? 当用户仅要求使用命令行时,如何加快WindowsForms应用程序的启动速度? - How to speed up a WindowsForms Application startup when the user only requires the CommandLine usage? 加速控制台应用程序 - Speed up the Console Application 如何加快构建时间? (C#/ Unmanaged C ++) - Ways to speed up build time? (C#/Unmanaged C++)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM