代码之家  ›  专栏  ›  技术社区  ›  MIantosca

Silverlight 2:在ADO.NET数据服务DataServiceContext上设置超时

  •  0
  • MIantosca  · 技术社区  · 15 年前

    我不知道如何在从Silverlight客户端调用的ADO.NET数据服务上设置超时。我看到一些博客文章提到DataServiceContext基类的超时属性。

    http://blogs.msdn.com/astoriateam/archive/2009/01/13/timeout-workaround.aspx

    但是,当我尝试设置Timeout属性时,它会出现在我的DataServiceContext上—但是该属性不存在。

    任何人都知道设置超时的其他方法-否则Silverlight应用程序将永远坐在那里等待。

    我确信有一种方法可以在调用服务的异步方法上设置超时,但我不想在每次方法调用上都设置超时-我想在服务级别处理它

    谢谢

    1 回复  |  直到 15 年前
        1
  •  0
  •   Jason Watts    15 年前
    <configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="AllocationsDataServiceSoap" maxBufferSize="2147483647"
                    maxReceivedMessageSize="2147483647" **receiveTimeout=""**>
                    <security mode="None" />
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address=""
                binding="basicHttpBinding" bindingConfiguration="AllocationsDataServiceSoap"
                contract="AllocationsDataWebService.AllocationsDataServiceSoap"
                name="AllocationsDataServiceSoap" />
        </client>
    </system.serviceModel>
    

    绑定标记中clientconfig.xml中的receiveTimeout属性

    编辑:添加服务引用时,将在项目根目录中创建此xml文件