[英]WCF timeout issue
我是WCF技術的新手,並且從我的silverlight應用程序中調用此WCF。
現在,我在WCF中定義了一個函數,該函數在同一PC上安裝的數據庫上調用SP。
此SP需要1分鍾的時間來執行並返回82000行(包含50列)。
我在應用程序中將wcf超時間隔設置為20分鍾。
現在,當我從Silverlight應用程序調用此WCF函數時,它在20分鍾后給我超時錯誤。 由於SP需要1分鍾才能執行,所以我想知道為什么會出現超時問題?
是什么原因導致超時? 我該怎么做才能避免這種情況? 我無法實現分頁或一次獲取所有這些數據所需的任何功能。
請幫助我。 我也附上了我的web.config文件,以供您參考。
Silverlight web.config文件
<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>
它可能比這更簡單。 您是否關閉或處置服務? 如果沒有,則很可能您的服務連接仍處於打開狀態。 一旦達到超時限制,它就會出錯。 從服務中獲取數據后,明確關閉服務。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.