请求通道在等待 00:01:00 以后答复时超时

来源:互联网 发布:2016淘宝客好做吗 编辑:程序博客网 时间:2024/05/16 12:37

    最近写个工具用WCF服务的wshttpbinding通道,频繁调用一些接口, 一会就会出现“请求通道在等待 00:01:00 以后答复时超时。。。”的错误。

    发现那些接口都是很快返回的,也没用大数据量数据经过网络,所以不能是超时时间设置太短,也不可能是接收时间设置太短。

    在网上查询了下,一个url解决了我的问题:

    http://social.msdn.microsoft.com/Forums/en-IE/wcf/thread/223b042c-9930-4484-bef9-c9b22b764e4b

    关键点如下,设置serviceThrottling 的并发数:

   <serviceBehaviors>
                <behavior name="OKIS_WCFService.Behavior">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                    <!--关键配置-->
                    <serviceThrottling maxConcurrentCalls="10000" maxConcurrentSessions="10000"
                      maxConcurrentInstances="10000" />

                    <serviceCredentials>
                        <clientCertificate>
                            <authentication certificateValidationMode="None" />
                        </clientCertificate>
                        <serviceCertificate findValue="OKISX509PK" storeLocation="LocalMachine"
                          storeName="My" x509FindType="FindBySubjectName" />
                        <userNameAuthentication userNamePasswordValidationMode="Custom"
                          customUserNamePasswordValidatorType="OKIS_WCFService.WCFUserNamePasswordValidator,OKIS_WCFService" />
                    </serviceCredentials>
                </behavior>
                <behavior name="OKIS_WCFService.WCFS_CTI_INFOBehavior">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
                <behavior name="OKIS_WCFService.WCFS_GPSBehavior">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>

      其实是并发数设置太少了,后面再来请求就会等待,等待超时就会出现错误。


原创粉丝点击