首页 新闻 搜索 专区 学院

客户端外网端口直连WCF服务,有时候一次调用很久(几十秒)服务端才能收到。内网直连没发现这种情况。求救~

0
悬赏园豆:200 [待解决问题]

客户端外网端口直连WCF服务,有时候一次调用很久(几十秒)服务端才能收到。内网直连没发现这种情况。求救~

 外网有三四十个客户端并发调用服务,单个客户端里面取任务和提交任务是异步。 网络是光纤,应该也没问题。

具体情况,客户端在外网通过服务器暴露的IP及端口直连服务器上的WCF服务端程序:

服务端配置:
<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="EngineWCFService.TasksServiceBehavior">
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceThrottling maxConcurrentCalls="10000" maxConcurrentSessions="10000" maxConcurrentInstances="10000" />
          <serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:8012" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="EngineWCFService.TasksServiceBehavior" name="EngineWCFService.TasksService">
        <endpoint address="net.tcp://localhost:8735" binding="netTcpBinding" bindingConfiguration="NewTcpBinding" name="NetTcpEndpoint" contract="EngineWCFService.ITasksService" />
        <host>
          <timeouts closeTimeout="00:01:50" openTimeout="00:01:50" />
        </host>
      </service>
    </services>
    <bindings>
      <netTcpBinding>
        <binding name="NewTcpBinding" closeTimeout="00:04:00" openTimeout="00:01:30" sendTimeout="00:02:00" maxBufferPoolSize="52428800" maxBufferSize="2147483647" maxConnections="5000" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="65536000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="65536000" maxNameTableCharCount="2147483647" />
          <reliableSession enabled="false" />
          <security mode="None">
            <transport protectionLevel="None" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>

 

客户端配置:

<system.serviceModel>
    <bindings>
        <netTcpBinding>
          <binding name="NetTcpEndpoint" closeTimeout="00:03:00" openTimeout="00:03:00"
            receiveTimeout="00:10:00" sendTimeout="00:03:00" transactionFlow="false"
            transferMode="Buffered" transactionProtocol="OleTransactions"
            hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="2147483647"
            maxBufferSize="2147483647" maxConnections="1000" maxReceivedMessageSize="2147483647">
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
              maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
            <reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" />
            <security mode="None">
              <message algorithmSuite="Default" />
            </security>
          </binding>
        </netTcpBinding>
    </bindings>
    <client>
      <endpoint address="net.tcp://XX.XX.XX.XX:8735/" binding="netTcpBinding"
          bindingConfiguration="NetTcpEndpoint" contract="EngineWCFService.ITasksService"
          name="NetTcpEndpoint" />
    </client>
  </system.serviceModel>

 

服务端服务:

    [ServiceContract(CallbackContract = typeof(ITaskCallback))]
    public interface ITasksService

{

...

public bool SubmitResult(TaskResult result)

...

}

    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple)]
    public class TasksService : ITasksService

{

...

        public bool SubmitResult(TaskResult result)
        {

...

        }

}

注: 其中TaskResult里包含一个XML文件,也不是特别大,加上一些参数。

 

下面是为客户端TCP服务监控:

CZSky的主页 CZSky | 初学一级 | 园豆:7
提问于:2015-11-26 13:42
< >
分享
所有回答(2)
0

ping一下看看延迟。

Firen | 园豆:5483 (大侠五级) | 2015-11-26 19:07

从图里能看出来是卡在传输上了吗?

支持(0) 反对(0) CZSky | 园豆:7 (初学一级) | 2015-11-28 12:20
0

是偶尔还是经常发生?看看数据包大不大,搞个压缩什么的,看配置没啥问题

早起Abc | 园豆:279 (菜鸟二级) | 2015-12-11 15:26

还是会偶尔发生。

支持(0) 反对(0) CZSky | 园豆:7 (初学一级) | 2015-12-18 17:58
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册