标签: pollingduplexhttpbinding

WCF Silverlight客户端获取404未找到的轮询消息响应

最终WCF双工Silverlight 4客户端开始获取404 Not Found轮询消息的错误,在轮询从WCF服务发送到Silverlight客户端之后立即发生,有时这种情况发生在第二次轮询中,有时连接工作数小时甚至数天,但大多数在第一分钟失败.

!有趣的是,这个问题就像使用MaxMessagesPerPoll双工模式时已知的Silverlight 4错误一样,这里这里描述解决方案,但我正在使用SingleMessagePerPoll模式.ANyway我ClientStack按照建议尝试使用,但没有任何改变.

一般流程:

  1. SL客户端执行WCF服务方法,收到响应
  2. 然后, SL客户端立即开始向服务发送轮询消息,然后获取第二个或Ns轮询消息的异常

    System.Net.WebException:远程服务器返回错误:NotFound

  3. Fiddler仅显示404轮询消息的空响应
  4. 然后客户端Channel Faulted事件提出

我试图在出现这样的故障后重新连接SL客户端,单个重新连接重试流程:

  1. 处理Faulted事件
  2. 取消订阅所有频道活动,例如 Closed/Closing/Opened/Opening
  3. 使用正确的方式关闭通道 try { close } catch { abort }
  4. 所有下面的新线程民意调查线程:(我觉得这个工作稍微稳定一点 - 看看这篇文章)
  5. 等待45-70秒
  6. 使用相同的DuplexChannelFactory<T>实例创建新通道,仅为了记录目的订阅所有通道事件
  7. 执行WCF服务方法

1-10次重试(~1-10分钟)后,客户端最终连接到服务器并继续正常轮询.

在WCF服务日志中,我看到它获得了所有cleint请求,没有任何异常处理,因此似乎Silverlight客户端发生了一些事情.

基本信息:

  • .NET Framework 4.0
  • PollingDuplex
  • 异步WCF方法
  • IIS 6.0托管WCF服务
  • Silverligth 4客户
  • 客户端操作系统:Windows XP SP2
  • 服务器操作系统:Windows 2003 R2 SP2
  • NTLM身份验证
  • DuplexMode:SingleMessagePerPoll
  • 还有一个其他WCF服务在我的服务开始工作之前执行请求/回复,它不使用双工连接
  • 在SL客户端服务上,我将所有内容记录到UI中,以便查看所有事件流并为每个特定事件留出时间 …

.net silverlight wcf polling pollingduplexhttpbinding

7
推荐指数
1
解决办法
1286
查看次数

如何检测双向双工轮询客户端

使用HTTP轮询双工WCF通道跟踪了Tomek Janczuk的Pub/sub示例,但我注意到当客户端通过关闭浏览器而断开连接时,服务在下一次回调时没有注意到.我原本应该预料到一个例外,或者说某个端点不再存在.

你怎么知道客户何时离开,以便停止向该客户发布?

silverlight wcf pollingduplexhttpbinding

6
推荐指数
2
解决办法
1924
查看次数

PollingDuplexHttpBinding在5或6次调用后出现故障

我已经在Silverlight 4应用程序中实现了轮询双工,以便使用来自服务器的客户端回调获取大量数据,因此我的服务包含一些带有客户端回调的功能和一些没有回调的功能.当只有3或4个函数被称为并行时,它工作正常,当有超过5或6个并行调用时,我得到ServerTooBusyException(服务太忙).

设置serviceThrottling maxConcurrentCalls ="10000"maxConcurrentInstances ="10000"maxConcurrentSessions ="10000"值后,我无法解决问题.

当我将basichttpbinding应用于服务时,一切正常,但是当pollingDuplexHttpBinding应用时,它给出了错误

.net wcf pollingduplexhttpbinding

6
推荐指数
1
解决办法
365
查看次数

与Silverlight一起使用WCF双工轮询时出现死锁

我跟随Tomek Janczuk在silverlight tv上的演示,创建了一个使用WCF Duplex Polling Web服务的聊天程序.客户端订阅服务器,然后服务器向所有连接的客户端发起通知以发布事件.

想法很简单,在客户端上,有一个允许客户端连接的按钮.客户端可以编写消息并将其发布的文本框,以及显示从服务器接收的所有通知的更大文本框.

我连接了3个客户端(在不同的浏览器中 - IE,Firefox和Chrome),它们都运行良好.他们发送消息并顺利接收.当我关闭其中一个浏览器时,问题就出现了.一个客户一出门,其他客户就会卡住.他们停止收到通知.

我猜测服务器中通过所有客户端并向他们发送通知的循环卡在现在丢失的客户端上.我尝试捕获异常并将其从客户端列表中删除(请参阅代码)但它仍然没有帮助.

有任何想法吗?

服务器代码如下:

    using System;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Collections.Generic;
using System.Runtime.Remoting.Channels;

namespace ChatDemo.Web
{
    [ServiceContract]
    public interface IChatNotification 
    {
        // this will be used as a callback method, therefore it must be one way
        [OperationContract(IsOneWay=true)]
        void Notify(string message);

        [OperationContract(IsOneWay = true)]
        void Subscribed();
    }

    // define this as a callback contract - to allow push
    [ServiceContract(Namespace="", CallbackContract=typeof(IChatNotification))]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)]
    public class ChatService …
Run Code Online (Sandbox Code Playgroud)

silverlight wcf pollingduplexhttpbinding

5
推荐指数
1
解决办法
2345
查看次数

由于DuplexBinding,WCF服务引用生成一个空的reference.cs

我有WCF服务.这是配置

  <basicHttpBinding>
    <binding name="EmergencyRegistratorBinding">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows" />
      </security>
    </binding>
  </basicHttpBinding>
Run Code Online (Sandbox Code Playgroud)

和服务配置

  <service behaviorConfiguration="Default" name="Breeze.AppServer.Emergencies.EmergencyRegistrator">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="EmergencyRegistratorBinding"
        contract="Services.IEmergencyRegistrator" />
  </service>
Run Code Online (Sandbox Code Playgroud)

一切都很好.但我需要将basicHttpBingind更改为DuplexBinding.我添加了延伸:

<extensions>
  <bindingElementExtensions>
    <add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex"/>
  </bindingElementExtensions>
</extensions>
Run Code Online (Sandbox Code Playgroud)

并改变上面提到的行:

  <customBinding>
    <binding name="DuplexmergencyRegistratorBinding">
      <binaryMessageEncoding/>
      <pollingDuplex maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647" inactivityTimeout="02:00:00" serverPollTimeout="00:05:00"/>
      <httpTransport authenticationScheme="Negotiate"/>
    </binding>
  </customBinding>
Run Code Online (Sandbox Code Playgroud)

  <service behaviorConfiguration="Default" name="Breeze.AppServer.Emergencies.EmergencyRegistrator">
    <endpoint address="" binding="customBinding" bindingConfiguration="DuplexmergencyRegistratorBinding" contract="Breeze.Core.Services.IEmergencyRegistrator" />
    <endpoint address="mex" binding="customBinding" bindingConfiguration="DuplexmergencyRegistratorBinding" contract="IMetadataExchange"/>
  </service>
Run Code Online (Sandbox Code Playgroud)

我已将服务参考添加到WCF项目.引用已成功添加,但Reference.cs几乎为空.

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.225
//
//     Changes …
Run Code Online (Sandbox Code Playgroud)

wcf custom-binding pollingduplexhttpbinding

0
推荐指数
1
解决办法
9883
查看次数