增加 silverlight 应用程序的超时

发布于 2025-01-06 19:36:32 字数 184 浏览 0 评论 0原文

我有一个启用了 RIA 服务的 silverlight 4 应用程序,同时 silverlight 使用 WCF 服务,并且整个内容都托管在 IIS 上。 我需要增加 WCF 服务和 ria 服务以及 IIS 7.5 的 silverlight 超时。 如何设置相关超时设置(ria服务、WCF、IIS)? PS

配置中相应的字段在哪里?

I have a silverlight 4 application with RIA service enabled, also the silverlight uses a WCF service and the whole things are hosted on IIS.
I need to increase the timeout of the silverlight for the WCF service and ria services, and IIS 7.5.
How can I set the releated timeout settings (ria services, WCF, IIS)?
P.S

where are the correspoding fields in the configuration?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

完美的未来在梦里 2025-01-13 19:36:32

我遇到了同样的问题,我在这里发布了这个问题的答案:Silverlight 4 WCF RIA服务超时问题

这是答案:

我在这里回答了同样的问题:WCF ria 服务 SP1 超时已过期

答案:

我将解释我的上下文,我希望它对我有用。我确信这一点。

首先调用 RIA 服务,并使用一些域上下文,在我的示例中:

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

在此之前没有什么新内容。就这样,我每次 1 分钟后都会遇到同样的超时异常。我花了相当多的时间尝试面对如何更改超时定义,我尝试了 Web.config 中所有可能的更改,但一无所获。解决方案是:

创建一个 CustomEmployeeDomainContext,它是一个本地化在生成代码的同一路径中的分部类,该类使用钩子方法 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); 

    }
}

我期待你的反馈。

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 answered the same question here: WCF ria service SP1 timeout expired

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文