简体   繁体   中英

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.

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.

不确定这是否有用,我没有尝试过超时配置,但它可能会指向正确的方向: http//blogs.objectsharp.com/CS/blogs/dan/archive/2010/04/ 13 / maxitemsinobjectgraph的WCF的RIA服务,exception.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM