WCF调用错误:基础连接已关闭:连接意外关闭

时间:2020-04-19 19:59:02

标签: wcf azure-web-app-service

关于 WCF服务,我有一个非常烦人的问题。我有一个具有basichttpbindng的wcf服务。

该服务已发布到Azure Web App,并且超时设置为20分钟。在 180 秒后,出现以下错误:

基础连接已关闭:连接已关闭 意外地

我有如下方法:

public ProcessResult TestErrorMessage()

        {
            try
            {
                System.Threading.Thread.Sleep(320000);
                return new ProcessResult()
                {

                };
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }

        [OperationContract]
        ProcessResult TestErrorMessage();

您可以在下面找到这两个配置。

服务器配置:

 <bindings>
  <basicHttpBinding>
    <binding name="basicBindingConfiguration" closeTimeout="00:20:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <!--<security mode="None">-->
      <security mode="Transport">
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<services>
  <service name="Tefal.WebService.Integration.DivaIntegration" behaviorConfiguration="customBehavior">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicBindingConfiguration" contract="Tefal.WebService.Integration.IDivaIntegration" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="customBehavior">
      <!--<serviceMetadata httpsGetEnabled="false" />-->
      <serviceMetadata httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    </behavior>
  </serviceBehaviors>
</behaviors>

密码配置:

 <bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IDivaIntegration" closeTimeout="00:20:00"
      openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
      maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
      useDefaultWebProxy="true">
      <security mode="Transport" />
    </binding>
    <binding name="BasicHttpBinding_IDivaIntegration1" receiveTimeout="00:20:00"
      sendTimeout="00:20:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
      maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </basicHttpBinding>
</bindings>
<behaviors>
  <endpointBehaviors>
    <behavior name="ClientBehavior">
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    </behavior>
  </endpointBehaviors>
</behaviors>

0 个答案:

没有答案