WCF中服务太忙的错误

Ste*_*man 29 wcf web-services throttling

我在.Net WCF服务中间歇性地获得以下异常."位于http://MyServer/TestWCF/MyService.svc的HTTP服务太忙了."

我在这里错过了什么吗?

我使用基本的http绑定并启用了WCF限制.

<basicHttpBinding>
        <binding name="BasicHttpBinding_MyService" maxReceivedMessageSize="2147483647"
                 messageEncoding="Text" textEncoding="utf-16" sendTimeout="00:01:00" >
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="163840000"
                        maxDepth="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="16384" />
        </binding>
Run Code Online (Sandbox Code Playgroud)

....

<behavior name="MyWCFServices.MyServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceThrottling
                    maxConcurrentCalls="16"
                    maxConcurrentInstances="2147483647"
                    maxConcurrentSessions="10"/>
        </behavior>
Run Code Online (Sandbox Code Playgroud)

限制有助于解决问题吗?另外,我可以知道高流量网站限制的推荐参数值吗?

mar*_*c_s 10

你绝对可以尝试将服务限制行为maxConcurrentSessionsmaxConcurrentCalls服务限制增加到标准值30左右,看看是否会使错误消失.服务器太忙似乎表明更多的请求已经进入,而不是服务限制行为允许的区域,并且它们已被丢弃,因为在给定的超时期限内没有服务实例可用于服务它们.


小智 9

我的答案是,检查应用程序池是否正常运行?

我已经看到当应用程序池由于未被捕获的异常而死亡时发生此错误.

例如,考虑自定义配置部分 - 在那里出现错误,将导致您的应用程序在启动之前失败.在很短的时间内,太多这些将会杀死应用程序池.