繁体   English   中英

WCF客户端因大量数据而挂断电话

[英]WCF client hangs on call with lots of data

我在Azure VM上具有WCF服务,并且我的方法在服务器端需要花费大量时间(取决于我发送的数据大小)。

问题是有时调用此方法时我的客户端挂起。 我知道该方法已完成并到达最后一行,但是我的客户从未得到响应。 当我将大量数据传递给该方法时,就会发生这种情况,并且大约需要1个小时才能完成。 如果该方法在几分钟内完成,则客户端将成功获取响应。

这是我的web.config

<?xml version="1.0"?>
<configuration>

  <configSections>

    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="PrintCloud.WebService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      <section name="PrintCloud.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
    </sectionGroup>
  </configSections>

  <system.diagnostics>

    <sources>
      <source propagateActivity="true" name="System.ServiceModel" switchValue="Warning,ActivityTracing">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type=""/>
          </add>
          <add name="ServiceModelTraceListener">
            <filter type=""/>
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="C:\Logs\PrintCloudLog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
        <filter type=""/>
      </add>
    </sharedListeners>
    <trace>
      <listeners>
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
          <filter type=""/>
        </add>
      </listeners>
    </trace>
  </system.diagnostics>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
  </appSettings>

  <system.web>
    <compilation targetFramework="4.5" debug="true"/>
    <httpRuntime targetFramework="4.5"/>
    <customErrors mode="Off"/>
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="LargeSettings" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" openTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00" transferMode="Streamed">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="PrintCloud.PrintCloudService">
        <endpoint binding="basicHttpBinding" bindingConfiguration="LargeSettings"
          name="Default" contract="PrintCloud.PrintCloudService" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https"/>
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="2147483647" />
      </requestFiltering>
    </security>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>

和客户端配置:

binding.OpenTimeout = new TimeSpan(100, 0, 0);
binding.CloseTimeout = new TimeSpan(100, 0, 0);
binding.SendTimeout = new TimeSpan(100, 0, 0);
binding.ReceiveTimeout = new TimeSpan(100, 0, 0);

完全没有例外。 客户端根本无法从服务器获得响应。

这是我调用的方法:

public Domain.DocumentGenerationResponse GenerateDocument(Guid id, Domain.PrintOptions printOptions, Domain.Job job)

it returns only several short strings. job arguments contains 1000 documents (each document has an image 111Kb)

您应该检查超时或邮件大小配置。 检查此MSDN链接进行超时配置,并检查此链接进行消息配额大小配置。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM