asp.net - 在自托管 Web 应用程序中使用性能计数器

标签 asp.net azure owin self-hosting

我想对我的 Web Api 自托管应用程序进行压力测试。此应用程序托管在 Azure 辅助角色上。

我知道如何将性能计数器从我的工作角色获取到我的存储(用于分析),但因为我的 Web api 是使用 Microsoft.Owin.Host.HttpListener 自托管的,所以我不知道是否存在一些现有的性能我可以插入的计数器。

我尝试了几个计数器 perfmon :

  • AspNet 应用程序
  • Web 服务(这仅允许我选择 IIS 中定义的 Web 应用程序)

当我选择进程时,我没有像 req/sec 等有趣的计数器...

有没有办法激活自托管 Owin 应用程序的一些计数器?

只使用我没有做的配置? 使用其他 self 主机? 使用附加组件并修改我的代码? (添加属性...,我见过类似的东西 https://github.com/aliostad/PerfIt )

非常感谢。

最佳答案

我看到你提到了诊断,这些是我在诊断中使用的:

<PerformanceCounterConfiguration counterSpecifier="\Asp.net\Request Execution Time" sampleRate="PT1M" />
                <PerformanceCounterConfiguration counterSpecifier="\ASP.net\Requests Rejected" sampleRate="PT1M" />
                <PerformanceCounterConfiguration counterSpecifier="\Web Service(_Total)\Current Connections" sampleRate="PT1M" />
                <PerformanceCounterConfiguration counterSpecifier="\Web Service(_Total)\Connection Attempts/sec" sampleRate="PT1M" />

我所做的是进入 perfmon 并右键单击我的开发计算机上的“添加计数器”,然后在 cmd 提示符中输入我感兴趣的名称,如下所示:

typeperf "\Web Service(_Total)\Connection Attempts/sec"

我能够测试很多东西,看看哪些是有用的。

希望对你有帮助

=德文郡

关于asp.net - 在自托管 Web 应用程序中使用性能计数器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23417934/

相关文章:

c# - 将逻辑调用上下文从 OWIN 管道传递到 WebApi Controller

authentication - OWIN - 将应用程序信息关联到授权服务器

oauth - Web API OAUTH - 区分是否识别 token 已过期或未授权

asp.net - 如何使用 MSBuild 命令行运行 ASP.NET MVC 应用程序

ASP.NET 身份验证表单不适用于 CSS?

c# - Azure 队列读/写限制

Azure functionapp - 流量路由/金丝雀部署

c# - Azure Blob 存储 SAS token 未正确形成 .NET

c# - 无法加载在 Azure 中部署的应用程序中的类型“System.Diagnostics.ProductionBreakpointsStub 错误”

c# - 在模拟对数据库的 WCF 调用时遇到问题,显示 domain\Machine$ 登录失败