.net WCF basicHttpBinding不关闭连接
我尝试使用WCF服务运行压力测试。 压力测试模拟场景“多个并发用户执行一个服务请求”。 我使用自托管WCF服务、basicHttpBinding和ssl支持 在这次测试中,我发现性能有问题。这些问题的原因是服务没有关闭连接,因此打开的连接数不断增加(我使用netstat-n来计算打开的连接数)。 我试图禁用keep alive属性,但没用。有什么想法吗,有什么问题吗 这里是服务器配置:.net WCF basicHttpBinding不关闭连接,.net,wcf,http,.net,Wcf,Http,我尝试使用WCF服务运行压力测试。 压力测试模拟场景“多个并发用户执行一个服务请求”。 我使用自托管WCF服务、basicHttpBinding和ssl支持 在这次测试中,我发现性能有问题。这些问题的原因是服务没有关闭连接,因此打开的连接数不断增加(我使用netstat-n来计算打开的连接数)。 我试图禁用keep alive属性,但没用。有什么想法吗,有什么问题吗 这里是服务器配置: <system.serviceModel> <services>
<system.serviceModel>
<services>
<service
name="WorkerService"
behaviorConfiguration="SecureBehavior">
<endpoint
address=""
binding="customBinding"
bindingConfiguration="BasicHttpSSLWithoutKeepAliveBinding"
contract="IWorkerService"
/>
<host>
<baseAddresses>
<add baseAddress="https://localhost/service" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SecureBehavior">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="BasicHttpSSLWithoutKeepAliveBinding">
<textMessageEncoding />
<httpsTransport allowCookies="false"
keepAliveEnabled="false"/>
</binding>
</customBinding>
</bindings>
</system.serviceModel>
你需要关闭连接。请参见下面的问题:结束发生在客户端。您使用什么连接到主机:Java、C#、VB…?我使用python并在客户端关闭连接-我使用相同的“netsat-n”脚本进行检查。
@echo off
setlocal enabledelayedexpansion
:loop
set lc=0
for /f "usebackq delims=_" %%i in (`netstat -n`) do (
set /a lc=!lc! + 1
)
echo %lc%
ping -n 2 -w 1000 127.0.0.1 > nul
goto loop
endlocal