【问题标题】:Load testing WCF service hosted in local IIS using JMeter使用 JMeter 对托管在本地 IIS 中的 WCF 服务进行负载测试
【发布时间】:2019-12-30 13:42:13
【问题描述】:

我的要求是对托管在本地 IIS 服务器中的 WCF 服务进行负载测试。我们正在尝试提高 WCF 服务的性能。在 PROD 环境中,WCF 服务和使用该服务的桌面应用程序也驻留在同一台机器上。

因此,为了对 WCF 服务的现有性能进行基准测试,我尝试使用 JMeter 通过在托管服务的同一台机器上运行服务来对服务进行负载测试。

我正在使用 JMeter 的 HTTP 测试脚本记录器来捕获从桌面应用程序到 WCF 服务的任何请求,以便我以后能够增加线程数以获取性能测量结果。

问题是我无法捕获到本地 IIS 服务器中托管的服务的任何请求。但是,如果我在单独的服务器中托管相同的服务并从运行消费桌面应用程序的机器上执行 Jmeter,那么 Jmeter 能够捕获到该 Web 服务器的所有传出请求。

甚至可以记录服务和消费的请求吗 桌面应用程序都驻留在同一台机器上?

当前配置

我在 Jmeter 代理中使用 8895 作为端口号

windows 中的手动代理设置(使用 Jmeter 中配置的相同端口号)

桌面应用配置文件(向本地服务发送请求)

    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_IPayment" proxyAddress="http://127.0.0.1:8895" useDefaultWebProxy="false" bypassProxyOnLocal="false">                     
                <security mode="None" />
            </binding>            
        </wsHttpBinding>        
    </bindings>
    <client>
      <!--<endpoint address="http://10.2.179.100/PaymentService/Payment.svc " binding="wsHttpBinding"-->                      
      <endpoint address="http://127.0.0.1:88/Payment.svc" binding="wsHttpBinding"          
          bindingConfiguration="WSHttpBinding_IPayment" contract="PaymentServiceReference.IPayment"
            name="WSHttpBinding_IPayment" />
    </client>
</system.serviceModel>

【问题讨论】:

    标签: c# wcf iis jmeter load-testing


    【解决方案1】:
    1. 您可能需要添加 Microsoft Loopback Adapter 以捕获链接本地流量

    2. 您可能需要设置一个system-level HTTP proxy,例如:

      netsh winhttp set proxy 127.0.0.1:8895
      

    更多信息:How to Run Performance Tests of Desktop Applications Using JMeter

    【讨论】:

    • 感谢您的意见,我会尝试您的方法,看看是否在 Jmeter 中捕获了请求。
    • 非常感谢您的帮助,我终于成功了。除了您的建议之外,我还必须在桌面应用程序的 app.config 文件(WCF 端点地址)中使用本地计算机的 IPv4,但 localhost 或 127.0.0.1 不起作用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-03
    • 2010-09-12
    • 2017-01-27
    • 1970-01-01
    • 1970-01-01
    • 2011-04-22
    • 1970-01-01
    相关资源
    最近更新 更多