即使在我的服务类上使用 sgen 仍然会导致构造函数极其缓慢

发布于 2024-09-16 03:56:56 字数 768 浏览 11 评论 0原文

因此,我正在尝试加快应用程序的启动时间,并且我已经确定了一个需要解决的主要瓶颈。我们的每个 Web 服务客户端类都需要花费很长时间和一天的时间来实例化。一些调查显示这完全是由于 SoapHttpClientProtocol 运行GenerateXMLMappings 造成的。我开始搜索这方面的信息,发现这篇文章 Slow SoapHttpClientProtocol constructor

我已经准备好吹响号角了因为我的问题反映了信中所讨论的内容。我完成了第一篇文章中列出的每个步骤,使用 sgen 预生成序列化器 dll,然后从代码中删除各种标签,并将其构建到一个普通的 dll 中,我在应用程序中将其作为普通引用引用(而不是到网络参考)。然而,毕竟,在分析应用程序时我没有看到任何差异。大量的时间仍然花在作为 SoapHttpClientProtocol 构造函数的一部分的GenerateXMLMappings 上。

我已经验证它实际上正在使用我的自定义 Web 服务客户端 dll。我还验证了它至少在寻找 XmlSerializers dll(如果我不包含该文件,我可以看到 filenotfound 吐出它)。

有谁有关于 SoapHttpClientProtocol 构造函数如何决定它需要做什么的详细信息?这是一个非常令人沮丧的问题,因为整个过程似乎是黑匣子,没有很好的方法来了解内部实际发生的情况。

预先感谢您的任何帮助——我在这方面完全反对。

So I'm trying to speed up our applications startup times -- and I've identified a major bottleneck to work on. Each of our webservice client classes takes forever and a day to instantiate. Some investigation revealed this is entirely due to the SoapHttpClientProtocol running GenerateXMLMappings. I started searching for information on this and found this SO post Slow SoapHttpClientProtocol constructor

I was ready to sound the trumpets since my issues mirrored what was talked about there to the letter. I went through every step listed in the first post to use sgen to pre-generate a serializer dll, and then removed the various tags from the code and built that into a normal dll which I referenced in the applciation as a normal reference (as opposed to a web reference). However after all this, I don't see any difference when profiling the application. Tons of time is still soaked up doing GenerateXMLMappings as part of the SoapHttpClientProtocol constructor.

I have verified that it is in fact using my custom webservice client dll. I have also verified that it is at least looking for the XmlSerializers dll (if I do not include the file I can see a filenotfound is spit up about it).

Does anyone have detailed info about how the SoapHttpClientProtocol constructor decides what it needs to do? This is a really frustrating problem because the whole process seems to be blackboxed with no good way to see what is actually going on internally.

Thanks in advance for any help -- I'm completely against a wall on this one.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

墨离汐 2024-09-23 03:56:56

我经常打这个。我很乐意猜测,但猜测通常是错误的。

为了找出问题的真正原因,我只需在 IDE 下运行应用程序,并在运行缓慢时暂停几次,看看它在做什么。这就是这种技术

好吧,这是我见过的猜测,但对你来说可能是错误的。

  1. 在加载期间从资源中获取字符串。
  2. 构建数据结构时通知变得疯狂。
  3. 初始化第 3 方网格/控件,即使数据为空。
  4. 解析/编写 XML 的次数比您想象的要多。
  5. 压缩/解压缩比您想象的更多。

I hit this every so often. I'll be happy to guess, but guesses are usually wrong.

To find what the problem really is I just run the app under the IDE and pause it a few times while it's being slow, to see what it's doing. That's this technique.

OK, here are the guesses, which I've seen but for you are probably wrong.

  1. Fetching strings from resources during load.
  2. Notifications gone mad while building data structure.
  3. Initializing 3rd-party grids/controls, even with empty data.
  4. Parsing/Writing XML more than you thought.
  5. Zipping/Unzipping more than you thought.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文