简体   繁体   English

WCF服务监控

[英]WCF service monitoring

I am writing WCF service hosted in WinForms application. 我正在写WinForms应用程序中托管的WCF服务。 Is there some way to monitor performance and statistics(count of instances, count of calls to endpoints, duration of calls, etc...) about service and display them in Form in which service is hosted? 有什么方法可以监视有关服务的性能和统计信息(实例数,对端点的呼叫数,呼叫持续时间等),并在托管服务的表单中显示它们?

WCF can be configured to expose performance counters that can be monitored via perfmon or any other monitoring software that can access the performance logs. 可以将WCF配置为公开性能计数器 ,该性能计数器可以通过perfmon或任何其他可以访问性能日志的监视软件进行监视。

Here is a good article: How to consume ETW events from C# : 这是一篇很好的文章: 如何使用C#的ETW事件

In my previous post I explained how to collect ETW events from URL Rewrite (or any other IIS provider) and then display those structured events in the Event Viewer. 在我以前的文章中,我解释了如何从URL Rewrite(或任何其他IIS提供程序)收集ETW事件,然后在事件查看器中显示那些结构化事件。 Now I want to show you how to collect ETW events using C#. 现在,我想向您展示如何使用C#收集ETW事件。

The .NET Framework 3.5 provides a new namespace System.Diagnostics.Eventing.Reader where you can find useful classes for publishing ETW events, but doesn't provide a mechanism for consuming, so I had to write a class EventTraceWatcher for simplify things. .NET Framework 3.5提供了一个新的命名空间System.Diagnostics.Eventing.Reader,您可以在其中找到用于发布ETW事件的有用类,但没有提供使用的机制,因此我不得不编写EventTraceWatcher类来简化事情。

最后我用这个解决方案

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

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