我构建了一个运行良好多年的 .NET 控制台应用程序。自 11 月 23 日起,在生产环境中运行(从 Visual Studio 运行时运行正常)需要大量时间才能启动(15 秒)。
我试图通过 Process Monitor (ProcMon) 追溯发生了什么,我发现了这种模式:
- 应用正常启动
- 应用加载
cryptnet.dll
- 应用程序进入休眠状态,我看到一系列
TCP 重新连接
消息,其中机器尝试通过 HTTP(似乎在百慕大)到达 206.53.176.17。 - 应用查询关于
cryptnet.dll
的信息 - 应用尝试通过 HTTP 连接到 206.53.176.78。
15 秒后,一切重新开始工作(我看到访问 crypt32.dll
是应用程序继续加载的第一件事)。
我完全迷失了:问题不仅与我的机器有关,而且所有使用我的工具的同事都遇到了同样的问题。这似乎与加载应用程序时完成的 Authenticode 签名验证有关。
确实,当试图通过资源管理器查看 EXE 的数字签名时,单击详细信息需要 15 秒才能查看“数字签名详细信息”面板(没有任何错误)。证书的颁发者定义为:
CN = QV Schweiz ICA
OU = Issuing Certificate Authority
O = QuoVadis Trustlink Schweiz AG
C = CH
它仍然有效(消息说“这个数字签名没问题。”)。
注意:证书的根颁发者是http://www.quovadisglobal.bm/恰好在百慕大...
最佳答案
检查程序集 (Authenticode) 上的数字签名可能是导致延迟的原因。
摘自 this MSDN article :
Authenticode verification adds to the startup time. Authenticode-signed assemblies have to be verified with the certification authority (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.
关于c# - .NET 应用程序启动速度非常慢 - cryptnet.dll 试图访问百慕大的 IP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1781948/