【问题标题】:WCF Data Service-Timeout expired issue from mysql viewmysql 视图中的 WCF 数据服务超时问题
【发布时间】:2013-07-31 14:53:45
【问题描述】:

我已经用 mysql DB 创建了 wcf datatservices。我正在快速从表中获取数据。但是当我试图从视图中获取数据时,它会抛出超时异常。当直接在db中尝试时,数据变得非常快。

我尝试在 web.config 中设置以下内容。

 <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="NetHttpBinding" maxBufferPoolSize="2147483647"  closeTimeout="00:01:00"
                 openTimeout="00:01:00"  maxConnections="10"
                 receiveTimeout="00:10:00"
                 sendTimeout="00:10:00"
          maxBufferSize="524288" maxReceivedMessageSize="2147483647" />
      </netTcpBinding>
    </bindings>
    <services>
      <service name="MyService">
        <endpoint address="http://localhost:59825" binding="netTcpBinding"
          bindingConfiguration="NetHttpBinding" name="HttpBinding" />
      </service>
    </services>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
  </system.serviceModel>

还是超时异常。

编辑1:

当我尝试使用表格时,数据正在获取。我创建了一个视图作为从同一个表中选择 *。现在它也抛出超时异常。

请帮忙。

谢谢, 萨丽莎。

【问题讨论】:

    标签: c# mysql wcf entity-framework wcf-data-services


    【解决方案1】:
    <system.serviceModel>
      <bindings>
        <netTcpBinding>
        <binding name="longTimeoutBinding"
            receiveTimeout="00:10:00" sendTimeout="00:10:00">
          <security mode="None"/>
        </binding>
        </netTcpBinding>
       </bindings>
    
      <services>
        <service name ="longTimeoutService"
          behaviorConfiguration="longTimeoutBehavior">
          <endpoint address="net.tcp://localhost/longtimeout/"
            binding="netTcpBinding" bindingConfiguration="longTimeoutBinding">
    
          </endpoint>
        </service>
    ....
    

    编辑:

    如果您没有收到,请访问此链接:Explaination of different timeout types

    【讨论】:

      【解决方案2】:

      您可能在作为客户端的 asp.net 中设置配置。您还需要配置服务器 (WCF)。

      您必须在 WCF 配置中更改 receiveTimeout

      您也可以使用WCF Message Logging 进行诊断。

      【讨论】:

      【解决方案3】:

      我猜这与 WCF 配置无关。能否请您检查数据库中视图的权限,并确保他具有与表相同的权限。

      【讨论】:

      • 它与视图权限无关,因为当我们尝试使用较少数据的相同数据库时,它按预期工作。
      • 你在哪里托管 WCF 服务? IIS 还是控制台??
      【解决方案4】:

      由于该服务似乎可以处理较小的数据集,可能是因为您使用的是视图,因此在数据库服务器上处理结果时它处于空闲状态。这种情况下需要设置inactivityTimeout:

      <netTcpBinding>
          <binding name="NetHttpBinding" 
                   maxBufferPoolSize="2147483647"  
                   closeTimeout="00:01:00"
                   openTimeout="00:01:00"  
                   maxConnections="10"
                   receiveTimeout="00:10:00"
                   sendTimeout="00:10:00"
                   maxBufferSize="524288" 
                   maxReceivedMessageSize="2147483647">
              <reliableSession ordered="true" 
                               inactivityTimeout="00:10:00"
                               enabled="true" />
          </binding>
      </netTcpBinding>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-11-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多