简体   繁体   English

Outlook禁用VSTO加载项,抱怨加载时间

[英]Outlook disables VSTO addin, complains of load time

I have a very strange problem with an AddIn I developed. 我开发的AddIn有一个非常奇怪的问题。

Clients complain of the AddIn being disabled by outlook because of slow loading times but in my code (1.2s on avrg), I don't have any other custom codes running during start up apart from AddIn Express generated code which can be seen below. 客户抱怨AddIn由于加载速度慢而被Outlook禁用,但是在我的代码(avrg中为1.2s)中,除了AddIn Express生成的代码(如下所示)外,启动期间我没有运行任何其他自定义代码。

 private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            logger.Debug("Startup called");
            this.AddInStartup();
            #region Add-in Express Regions generated code - do not modify

            this.FormsManager = AddinExpress.OL.ADXOlFormsManager.CurrentInstance;
            this.FormsManager.OnInitialize += new AddinExpress.OL.ADXOlFormsManager.OnComponentInitialize_EventHandler(this.FormsManager_OnInitialize);
            this.FormsManager.Initialize(this);
            #endregion
            logger.Debug("Exit Startup");
        }

Also, I have a ribbon Ribbon (Button), that gets loaded. 另外,我有一个功能区Ribbon(按钮),该功能区已加载。

All functionality codes for the addIn such as login, webservice calls are only performed when outlook is opened with the Ribbon button clicked. addIn的所有功能代码(例如登录,Web服务调用)仅在单击功能区按钮打开Outlook时执行。

Are there any underlying issues i may have looked past or possible external reasons not related to my code where outlook will complain of my addIn starting up slow when all that happens is just the ribbon being loaded during outlook start time ? 我可能已经看过任何潜在的问题,或者可能是与代码无关的外部原因,当仅在Outlook启动时加载功能区时,Outlook会抱怨我的addIn启动缓慢?

There are multiple reasons why your add-in starts slowly.... 加载项启动缓慢的原因有多种。

But the very first thing to start with is to remove any Add-in Express code and see how much time it takes to load. 但是首先要开始的是删除所有Add-in Express代码,并查看加载所需的时间。 Do you get the same picture with a newly created add-in project without Add-in Express assemblies? 在没有Add-in Express程序集的情况下,新创建的外接程序项目是否得到相同的图片?

I'd suggest applying common approaches for increasing the overall add-in performance such as: 我建议采用通用方法来提高整体加载项性能,例如:

  1. Consider using the Native Image Generator (Ngen.exe) on your application. 考虑在您的应用程序上使用本机映像生成器(Ngen.exe)。 Using Ngen.exe means trading CPU consumption for more disk access because the native image generated by Ngen.exe is likely to be larger than the MSIL image. 使用Ngen.exe意味着要用CPU消耗来换取更多的磁盘访问权限,因为Ngen.exe生成的本机映像可能比MSIL映像大。 To improve the warm startup time, you should always use Ngen.exe on your application, because this avoids the CPU cost of JIT compilation of the application code. 为了缩短预启动时间,您应该始终在应用程序上使用Ngen.exe,因为这样可以避免JIT编译应用程序代码的CPU成本。
  2. If an assembly is not installed in the Global Assembly Cache (GAC), there are delays caused by hash verification of strong-named assemblies and by Ngen image validation if a native image for that assembly is available on the computer. 如果在全局程序集缓存(GAC)中未安装程序集,则由于强命名程序集的哈希验证和Ngen映像验证(如果计算机上有该程序集的本地映像)而导致延迟。 Strong-name verification is skipped for all assemblies installed in the GAC. 对于GAC中安装的所有程序集,都会跳过强名称验证。 For more information, see Gacutil.exe (Global Assembly Cache Tool). 有关更多信息,请参见Gacutil.exe(全局程序集缓存工具)。
  3. Authenticode verification adds to the startup time. Authenticode验证会增加启动时间。 Authenticode-signed assemblies have to be verified with the certification authority (CA). Authenticode签名的程序集必须通过证书颁发机构(CA)进行验证。 This verification can be time consuming, because it can require connecting to the network several times to download current certificate revocation lists. 此验证可能很耗时,因为它可能需要多次连接到网络才能下载当前的证书吊销列表。 It also makes sure that there is a full chain of valid certificates on the path to a trusted root. 它还可以确保在通往受信任根目录的路径上有完整的有效证书链。 This can translate to several seconds of delay while the assembly is being loaded. 加载装配件时,这可能会延迟几秒钟。 Consider installing the CA certificate on the client computer, or avoid using Authenticode when it is possible. 考虑在客户端计算机上安装CA证书,或者尽可能避免使用Authenticode。 If you know that your application does not need the publisher evidence, you do not have to pay the cost of signature verification. 如果您知道自己的应用程序不需要发布者的证据,则不必支付签名验证的费用。

See Application Startup Time for more information. 有关更多信息,请参见应用程序启动时间 Also take a look at tje following pages: 还请看以下几页:

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

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