开发者

RIA services WCF timeout

I have an application which is written in silverlight 3.0. It uses RIA services to communicate between the client and server.

My question doesn't seem to be answered very well on the web. The client communicates to the server using RIA services, which uses WCF behind the scenes. If the communication takes more than 60 seconds it times out with this message,

'Load operation failed for query 'ApplyUpgrade'. The HTTP requrest to 'http://localhost:52403/ClientBin/DatabaseUpgradeTool-Web-UpgradePackageDomainService.svc/binary' has exceeded the allotted timeout. The time allotted to this operation may have been a portion of a longer timeout.'

My server is performing a database upgrade, so it is valid for it to take more than 60 seconds. Probably double or triple that.

I tried settings like this in the web.config,

<services>
    <service name="DatabaseUpgradeTool.Web.UpgradePackageDomainService">
      <endpoint address="" binding="wsHttpBinding" contract="DatabaseUpgradeTool.Web.UpgradePackageDomainService"></endpoint>
      <endpoint address="/soap" binding="basicHttpBinding" contract="DatabaseUpgradeTool.Web.UpgradePackageDomainService"></endpoint>
      <endpoint address="/binary" binding="customBinding" bindingConfiguration="BinaryHttpBinding" contract="DatabaseUpgradeTool.Web.UpgradePackageDomainService"></endpoint>
    </service>
  <开发者_开发技巧/services>
<bindings>
    <customBinding>
      <binding name="BinaryHttpBinding"
               receiveTimeout="00:00:10"
               sendTimeout="00:00:10" 
               openTimeout="00:00:10" 
               closeTimeout="00:00:10">
        <binaryMessageEncoding   />
        <httpTransport keepAliveEnabled="true"/>
      </binding>
    </customBinding>
  </bindings>

Still no joy. Any ideas as to what is wrong with what I have tried above? I would expect the above to cause it to timeout within 10 seconds, not 60.

Thanks.


Not sure if this will help, I haven't tried it with time outs configurations, but it might point you in the right direction: http://blogs.objectsharp.com/CS/blogs/dan/archive/2010/04/13/maxitemsinobjectgraph-wcf-ria-services-exception.aspx


I faced the same problem, I posted the answer to this question here: Silverlight 4 WCF RIA Service Timeout Problem

Here is the answer:

I'll explain my context and I wish it will work for my. I'm sure about that.

First of all to call RIA services, and using some domain context, in my example:

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

Nothing new until here. And with this I was facing every time that same timeout exception after 1 minute. I spend quite a lot of time trying to face how to change the timeout definition, I tried all possible changes in Web.config and nothing. The solution was:

Create a CustomEmployeeDomainContext, that is a partial class localizated in the same path of the generated code and this class use the hook method OnCreate to change the behavior of created domain context. In this class you should wrote:

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); 

    }
}

I looking forward for you feedback.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜