2012-02-19 12 views
1

我有啓用了RIA服務的Silverlight 4應用程序,Silverlight也使用WCF服務,並且所有東西都託管在IIS上。 我需要增加WCF服務和ria服務以及IIS 7.5的Silverlight超時。 如何設置相關超時設置(ria服務,WCF,IIS)? P.S在Silverlight應用程序中增加超時

其中是配置中的對應字段?

+0

如果您可以發佈錯誤消息,它會更容易幫助。在傳輸大量數據(IIS/web.config設置)時,網站請求可能會超時。或者查詢大型數據集(SQL命令設置)時數據庫連接可能會超時。什麼是您收到的錯誤信息? – bperreault 2012-02-19 14:04:29

+1

我在問我可以在哪裏配置超時,無論何時存在(asp.net,IIS,ria服務,wcf服務,silverlight) – 2012-02-19 16:19:22

回答

0

我面臨同樣的問題,我發佈了這個問題的答案在這裏:Silverlight 4 WCF RIA Service Timeout Problem

下面是答案:

我回答在這裏同樣的問題:WCF ria service SP1 timeout expired

答案:

我會解釋我的背景,我希望它能爲我的工作。我很確定。

首先調用RIA服務,並使用一些領域的背景下,我的例子:

EmployeeDomainContext context = new EmployeeDomainContext(); 
InvokeOperation<bool> invokeOperation = context.GenerateTMEAccessByEmployee(1, 'Bob'); 
invokeOperation.Completed += (s, x) => 
    {....}; 

沒有新東西,直到這裏。與此同時,我每次在1分鐘後都面臨同樣的超時異常。我花了很多時間試圖去面對如何改變超時定義,我嘗試了Web.config中的所有可能的改變,而沒有做任何改變。解決的辦法是:

創建CustomEmployeeDomainContext,即在生成的代碼的相同路徑localizated的局部類和此類中使用的鉤方法OnCreate中改變創建域上下文的行爲。在這堂課你應該寫:

public partial class EmployeeDomainContext : DomainContext 
{ 
    partial void OnCreated() 
    { 
     PropertyInfo channelFactoryProperty = this.DomainClient.GetType().GetProperty("ChannelFactory"); 
     if (channelFactoryProperty == null) 
     { 
      throw new InvalidOperationException(
       "There is no 'ChannelFactory' property on the DomainClient."); 
     } 

     ChannelFactory factory = (ChannelFactory)channelFactoryProperty.GetValue(this.DomainClient, null); 

     factory.Endpoint.Binding.SendTimeout = new TimeSpan(0, 10, 0); 

    } 
} 

我期待您的反饋。