首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WCF WPF银灯wsDualHttpBinding pollingDuplexHttpBinding

WCF WPF银灯wsDualHttpBinding pollingDuplexHttpBinding
EN

Stack Overflow用户
提问于 2012-08-21 14:23:45
回答 1查看 1.3K关注 0票数 1

我几个小时都在努力让这个银灯复式工作但一次又一次失败,

我有A)WCF服务应用程序B) WPF客户端C) Silverlight客户端(我需要+主机吗?!)

我连接成功的A<=>B -工作良好,我的问题是A<=>C (Silverlight双工客户端)

  • 我能有两个端点吗?wsDualHttpBinding & pollingDuplexHttpBinding?试过又失败

无法加载合同'Service2.IService1‘的端点配置部分,因为找到了该契约的多个端点配置。请按名称指定首选端点配置部分。

  • pollingDuplexHttpBinding能在WPF上工作吗?
  • 救命啊!谢谢!

Web.Config

代码语言:javascript
复制
<!-- Register the binding extension from the SDK. -->
<extensions>
  <bindingExtensions>
    <add name="pollingDuplexHttpBinding"
         type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement,
               System.ServiceModel.PollingDuplex, 
               Version=4.0.0.0, 
               Culture=neutral, 
               PublicKeyToken=31bf3856ad364e35" />
  </bindingExtensions>
</extensions>

<client>
  <endpoint address="http://localhost:8732/Service1/" binding="wsDualHttpBinding" bindingConfiguration="wsDualHttpBinding" contract="TheWCFService.IService1" name="WSDualHttpBinding_Service1" />
</client>

<bindings>

  <wsDualHttpBinding>
    <binding name="wsDualHttpBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483646" maxArrayLength="2147483646" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </wsDualHttpBinding>

  <pollingDuplexHttpBinding>
    <binding name="multipleMessagesPerPollPollingDuplexHttpBinding"
             duplexMode="MultipleMessagesPerPoll"
             maxOutputDelay="00:00:07"/>
  </pollingDuplexHttpBinding>

</bindings>



<services>

  <service behaviorConfiguration="" name="TheWCFService.Service1">

    <endpoint address="" 
              binding="wsDualHttpBinding" 
              bindingConfiguration="wsDualHttpBinding" 
              contract="TheWCFService.IService1">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>

    <endpoint 
      address="mex"
      binding="mexHttpBinding" 
      bindingConfiguration="" 
      contract="IMetadataExchange" />

    <!--<endpoint
       address="/2"
       binding="pollingDuplexHttpBinding"
       bindingConfiguration="multipleMessagesPerPollPollingDuplexHttpBinding"
       contract="TheWCFService.IService1">
    </endpoint>-->

    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8732/Service1/" />
      </baseAddresses>
    </host>

  </service>
</services>

<behaviors>
  <serviceBehaviors>
    <behavior name="">
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true" />
        <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false" />
      <serviceThrottling maxConcurrentSessions="500" maxConcurrentCalls="500" maxConcurrentInstances="500" />
    </behavior>
  </serviceBehaviors>
</behaviors>

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-08-22 07:55:58

所以是的,有可能有两个以上的端点:

第一步:

代码语言:javascript
复制
<endpoint address="wsDualHttpBinding" 
                  binding="wsDualHttpBinding" 
                  bindingConfiguration="wsDualHttpBinding" 
                  contract="TheWCFService.IService1">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>

        <endpoint 
          address="mex"
          binding="mexHttpBinding" 
          bindingConfiguration="" 
          contract="IMetadataExchange" />

        <endpoint
           address="pollingDuplexHttpBinding"
           binding="pollingDuplexHttpBinding"
           bindingConfiguration="multipleMessagesPerPollPollingDuplexHttpBinding"
           contract="TheWCFService.IService1">
        </endpoint>

        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8732/Service1/" />
          </baseAddresses>
        </host>

步骤2:非常重要: WCF跨域SecurityException

http://www.itscodingtime.com/post/Silverlight-to-WCF-Cross-Domain-SecurityException.aspx

第三步:

Silverlight客户:

代码语言:javascript
复制
            var x = new WCFService.Service1Client(
                    new PollingDuplexHttpBinding { DuplexMode = PollingDuplexMode.MultipleMessagesPerPoll, },
                    new EndpointAddress(@"http://localhost:59732/Service1.svc/pollingDuplexHttpBinding")
                    );

WPF客户端:

代码语言:javascript
复制
>  _objProxy = new Service1Client(new InstanceContext(this),
> "WSDualHttpBinding_IService1");
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12057009

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档