2013-07-31 56 views
2

我已经创建与MySQL数据库的wcf数据服务。我快速地从表格中获取数据。但是当我试图从视图中获取数据时,它引发超时异常。直接在db数据中尝试时,速度非常快。从MySQL视图WCF数据服务超时过期问题

我尝试在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> 

仍超时异常。

EDIT1:

当我与表试过,数据也越来越。我在同一个表中创建了一个视图select *。现在也是抛出超时异常。

请帮忙。

谢谢, Saritha。

回答

1

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

您必须在WCF配置中更改receiveTimeout

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

+0

可以请您给的步骤来做到这一点? –

+0

@ Saritha.S.R http://stackoverflow.com/questions/424358/increasing-the-timeout-value-in-a-wcf-service –

+0

是的。我们的确如此。仅使用WCF服务配置编辑器添加了绑定。 –

2
<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> 
.... 

编辑:

如果你没有得到那么PLZ访问此链接:Explaination of different timeout types

+0

我做了同样的,但没有得到.. –

0

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

+0

它与视图权限无关,因为当我们用较少的数据尝试同一个数据库时,它按预期工作。 –

+0

你在哪里托管WCF服务? IIS或控制台? – rauts

+0

我们在IIS中托管它(.net framework 4) –

0

由于该服务似乎适用于较小的数据集,因此可能是因为您使用的是视图,而在数据库服务器上正在处理结果时,它会空转。在这种情况下你需要设置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>