Visual Studio 2010 性能分析可以与用 C# 编写的 Windows 服务一起使用吗
我想使用内存分析器来确定在用 C# 编写的相当复杂的 Windows 服务中是否有内存链接,该服务有大量正在运行的线程。如果我在服务中循环代码不断重复相同的操作,则其内存占用量会不断增加。
我很失望地发现 Visual Studio 2010 中内置的性能分析工具无法与 Windows 服务一起使用(或者至少看起来无法与 Windows 服务一起使用)。
有谁知道如何让 VS 2010 工具与 Windows 服务一起使用?
I'd like to use a memory profiler to determine if I have memory links in a fairly complicated windows service written in C#, that has a large number of running threads. If I loop the code in the service continuously repeating the same operations, its memory footprint grows continuously.
I was disappointed to find out that the Performance Analysis tools built into Visual Studio 2010 would not work with a Windows Service (or at least it didn't appear to be possible to use it with a Windows Service).
Does anyone know a way of getting the VS 2010 tools to work with a Windows Service?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道的唯一解决方法是重构您的服务,使其能够作为应用程序以及基于命令行开关的 Windows 服务运行 - 请参阅 此处 获取详细的解决方案。这样,您现在可以在作为常规应用程序运行时应用性能分析,并且完成后无需修改代码库即可作为 Windows 服务运行。
The only workaround I know of is refactoring your service to be able to run as application as well as windows service based on a command line switch - see here for a detailed solution to this. In doing that you can now apply performance analysis when running as regular application and you do not have to modify your code base to run as Windows service once you are done.