我是WCF技术的新手,我正在从我的silverlight应用程序调用这个WCF。
现在,我在WCF中定义了一个函数,该函数调用安装在同一台PC上的数据库上的SP。
此SP执行时间为1分钟,并返回82000行50列。
我在应用程序中将wcf超时时间设置为20分钟。
现在,当我从我的silverlight应用程序调用这个WCF函数时,它在20分钟后给我超时错误。由于SP需要1分钟来执行,我想知道为什么会出现这个超时问题?
是什么导致了超时?我能做些什么来避免这种情况?我不能实现分页或任何我需要一次获得所有这些数据。
请帮帮我,伙计们。我已经把我的网粘上了。
Silverlight。配置文件
<behaviors>
<endpointBehaviors>
<behavior name="ExportServiceRestBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ExportServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentSessions="2147483647" maxConcurrentInstances="2147483647" />
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="ExportServiceBehavior" name="DebtorBal.Web.ExportService1">
<endpoint binding="basicHttpBinding" bindingConfiguration="ExportServiceBinding"
contract="DevExpress.Xpf.Printing.Service.IExportService" />
<endpoint address="rest" behaviorConfiguration="ExportServiceRestBehavior"
binding="webHttpBinding" bindingConfiguration="ExportServiceRestBinding"
contract="DevExpress.Xpf.Printing.Service.IExportServiceRest" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="ExportServiceBinding" maxReceivedMessageSize="50000000"
transferMode="Streamed">
<security>
<transport realm="" />
</security>
</binding>
<binding name="myBindingForBigArrays" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="64" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security>
<transport realm="" />
</security>
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="ExportServiceRestBinding" transferMode="Streamed" />
</webHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:49261/LsnMonService.svc"
binding="basicHttpBinding" bindingConfiguration="myBindingForBigArrays"
contract="ServiceReference1.ILsnMonService" name="BasicHttpBinding_ILsnMonService" />
</client>
</system.serviceModel>
WCF配置文件
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" />
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentSessions="2147483647" maxConcurrentInstances="2147483647" />
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
可能比这更简单。你曾经关闭或处理过你的服务吗?如果不是,那么很可能您的服务连接仍然打开。一旦达到超时限制,它就会出错。在获取数据后显式地关闭服务