我实现了一个 WPF 应用程序,并将其注册为在 Windows 启动时启动。我的应用程序是一个简单的登录应用程序,当用户登录时,它会出现在图标托盘中。问题是 Windows 启动后需要大约 30 秒才能显示出来。我尝试过 Ngen 但没有取得很大成功。我想避免实现闪屏。我希望我的 WPF 应用程序在 Windows 启动后“立即”出现,类似于 Windows Live Messenger 的操作。我可以做些什么来减少其启动时间?除了本地编码之外我还有其他选择吗?
谢谢。
I implemented a WPF app and had it registered to launch at windows startup. My app is a simple logon app which when the user is logged on appears in the icon tray.The problem is that it takes about 30 seconds to show itself after Windows startup. I've tried Ngen without great success. I would like to avoid implementing a splash screen. I would like my WPF app to appear "immediately" after Windows startup similar to what Windows Live Messenger does. Anything I can do so as to reduce its startup time? Do I have any other choice than to code it natively?
Thanks.
发布评论
评论(4)
当计算机空闲时是否也需要 30 秒才能启动(即,如果在计算机不忙于加载 Windows 时通过双击启动它)?
在 Windows 启动期间,计算机通常会忙于处理大量事务,这可能会导致应用程序运行缓慢。那时你无能为力。
但是,有一些改进 WPF 应用程序启动的一般技巧:
BackgroundWorker
或使用异步调用来执行 I/O 和网络请求您还可以在
app.config
中放入一个设置code> 告诉运行时不要使用以下命令对程序集进行身份验证证书(此检查可能需要很长时间,尤其是冷启动):MSDN 站点 应用程序启动时间。
Does it also take 30 seconds to start when the computer is idle (i.e if you start it by double clicking when the computer is not busy loading windows)?
During windows startup, the computer is typically busy with a lot of stuff and that could cause slowness for your application. Not much you can do then.
But, some general tips for improving startup of a WPF application:
BackgroundWorker
or use asynchronous calls to do I/O and network requestsThere is also a setting you can put in
app.config
that tells the runtime to not authenticate the assemblies with the certificate (this check can take a long time, especially cold starts):Some more general tips are available on the MSDN site on Application Startup Time.
也许这个网站会对您有所帮助。它列出了在 Windows 登录之前(如果它是服务)或之后启动应用程序的一些选项。它们涉及一些注册表黑客攻击,您需要在卸载过程中撤消这些黑客攻击。
Maybe this site will be helpful to you. It lists some of the options you have for starting an application before (if it's a service) or after Windows login. They involve some registry hacking which you'll need to undo during uninstall.
我非常喜欢 wpftutorial.net 的性能提示。
I like the Performance Tips of the wpftutorial.net much.
使用regedit,在注册表中创建一个DWORD
名为 StartupDelayInMSec。
默认值应设置为 0,但请仔细检查。
这使我的应用程序启动后的启动时间缩短了大约 10 秒。
注意:序列化密钥可能不存在。
您可以通过右键单击资源管理器并选择新建 -> 创建它。关键
Using regedit, Create a DWORD in the registry at
called StartupDelayInMSec.
Default value should be set to 0, but double check.
This cut about 10 seconds off for my application launch time after startup.
note: The Serialize Key may not exist.
You can create it by right-clicking on Explorer and selecting New -> Key