如何使用wcf从Windows服务器服务总线读取消息?

时间:2015-03-12 17:33:03

标签: wcf wcf-binding azureservicebus

我正在使用

在Windows服务器服务总线上发布xml
    BrokeredMessage message = new BrokeredMessage("Xml as string");      

尝试阅读下面的wcf服务

    //System.ServiceModel.Channels.Message
    public void TopicReader(Message message) 
            {

            }

将设置配置为

     <bindings>
     <netMessagingBinding>
            <binding name="messagingBinding" closeTimeout="00:03:00" openTimeout="00:03:00"
                   receiveTimeout="00:03:00" sendTimeout="00:03:00" sessionIdleTimeout="00:01:00"
                   prefetchCount="-1">
              <transportSettings batchFlushInterval="00:00:01" />
            </binding>
          </netMessagingBinding>
        </bindings>
        <behaviors>
          <endpointBehaviors>
            <behavior name="securityBehavior">
              <transportClientEndpointBehavior>
                <tokenProvider>

                  <windowsAuthentication>
                    <stsUris>
                      <stsUri value="https://MahindeName/Namespace" />

                    </stsUris>
                  </windowsAuthentication>
                </tokenProvider>
              </transportClientEndpointBehavior>

            </behavior>

端点名称=&#34; TopicReader&#34; listenUri =&#34; SB:// MahindeName /命名空间/ TopicName /订阅/子&#34;                       地址=&#34; SB:// MahindeName /命名空间/ TopicName&#34;结合=&#34; netMessagingBinding&#34; bindingConfiguration =&#34; messagingBinding&#34;                       合同=&#34; Service.ITopicReader&#34; behaviorConfiguration =&#34; securityBehavior&#34;

服务托管没有任何错误,但我们无法收到消息,并且递送计数正在增加。

1 个答案:

答案 0 :(得分:0)

根据我的经验,你需要在接收发生之前获得相当多的东西。我的建议是尝试使用WCF发布,一旦你能够通过wcf成功发布,那么该配置也适合接收。