我正在创建一个 WCF 服务器-客户端应用程序。但是,在我的第一个测试中,一个简单的调用(该方法基本上只是return true;)需要很多时间(~5 秒)
我试图追踪它,这是呼叫追踪的截图

正如您在第 2 行和第 3 行之间看到的那样,间隔了 5 秒(虽然老实说我不知道第 2 行和第 3 行是什么意思)
在客户端(调用者)的配置下,绑定是这样的(多为Visual Studio生成
    <wsHttpBinding>
        <binding name="WSHttpBinding_IAgent" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
          textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
            enabled="false" />
          <security mode="None">
          </security>
        </binding>
      </wsHttpBinding>
并在服务器上
<wsHttpBinding>
    <binding name="WSHttpBinding_IAgent" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:05:00" sendTimeout="00:05:00"
      bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
      maxBufferPoolSize="16777216" maxReceivedMessageSize="16777216"
      messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
      allowCookies="false">
      <readerQuotas maxDepth="32" maxStringContentLength="16777216"
        maxArrayLength="16384" maxBytesPerRead="16384" maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00"
        enabled="false" />
      <security mode="None"/>
    </binding>
我称之为这样的方式
var client = new AgentClient(binding, BuildEndpointAddress(hostName, port));
for(int i =0; i<10; i++)
    client.IsAlive(); //this call is very slow despite just returning true;
    // subsequent calls are also slow so probably not because of wake-up time
请注意此测试,服务器和客户端都在同一台计算机上,因此它不会是网络问题。知道是什么导致了速度缓慢,或者我如何找到更多信息来解决这个问题?