首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WCF >> DUPLEX >> SILVERLIGHT >> pollingDuplexHttpBinding =非常慢!大延迟

WCF >> DUPLEX >> SILVERLIGHT >> pollingDuplexHttpBinding =非常慢!大延迟
EN

Stack Overflow用户
提问于 2012-08-30 22:47:16
回答 1查看 852关注 0票数 0

我有过

WCF与wsDualHttpBinding绑定的WPF应用程序-->工作良好!立即获取WCF发布方法。

在wpf应用程序获得它之后,与Silvelight4 --> very slow --> pollingDuplexHttpBinding的另一个绑定延迟了30++秒( WPF立即获得它)

为什么会这样呢?最好的google结果是

http://blogs.msdn.com/b/silverlightws/archive/2009/09/30/having-a-pollingduplex-service-and-any-other-wcf-service-in-the-same-website-causes-silverlight-calls-to-be-slow.aspx

我真的不知道该怎么做。

代码语言:javascript
复制
<system.serviceModel>

    <!-- 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>

    <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:30"
                 maxBufferPoolSize="2147483647"
                 maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647"
                        maxStringContentLength="2147483646"
                        maxArrayLength="2147483646"
                        maxBytesPerRead="2147483647"
                        maxNameTableCharCount="2147483647" />
        </binding>
      </pollingDuplexHttpBinding>
    </bindings>



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

        <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>

      </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="true" />
          <dataContractSerializer maxItemsInObjectGraph="6553600"/>
          <serviceThrottling maxConcurrentSessions="500" maxConcurrentCalls="500" maxConcurrentInstances="500" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-11-15 01:13:31

第一步:从服务中删除AspNetCompatibilityRequirements

代码语言:javascript
复制
  [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1 : IService1

代码语言:javascript
复制
public class Service1 : IService1

如果从Web.config设置,请将其删除。

Silverlight第二步:在中使用客户端堆栈

代码语言:javascript
复制
 private void Application_Startup(object sender, StartupEventArgs e)
        {
                WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
                WebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp);
        }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12199583

复制
相关文章

相似问题

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