Silverlight 4 WCF RIA Service Timeout Problem

I have a Silverlight 4 user control that calls a very long WCF RIA service. As shown below, I increase the default wait period.

_domainContext = new WindowsDashboardDomainContext();
// Increase timeout -- this can be a very long running query
((WebDomainClient<WindowsDashboardDomainContext.IWindowsDashboardDomainServiceContract>)
_domainContext.DomainClient).ChannelFactory.Endpoint.Binding.SendTimeout = new TimeSpan(99, 0, 0);
    _domainContext.GetSections( "All", "All", "All" ).Completed += GetAllSectionsCompleted;

Unfortunately, it seems to ignore this timeout and still throw a timeout exception:

Error: Unhandled error in Silverlight application. Error loading application for request "GetClicks". An error occurred while executing the command definition. See Internal Exception for more details. Internal exception message: Timeout. The wait period expires before the operation is completed or the server is not responding. in System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands (EntityCommand entityCommand, CommandBehavior behavior)

Why is this happening?

+2
2

: WCF ria

:

, , . .

, RIA - , :

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

. - 1 . , , -, Web.config . :

CustomEmployeeDomainContext, , , hook 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); 

    }
}

.

+2

:

  • DomainService . . . , .
  • . - LINQ to SQL, EF ADO.NET . , .
+1

Source: https://habr.com/ru/post/1731952/


All Articles