WCF>&燃气轮机;双工>&燃气轮机;SILVERLIGHT>&燃气轮机;pollingDuplexHttpBinding=非常慢!大延误

WCF>&燃气轮机;双工>&燃气轮机;SILVERLIGHT>&燃气轮机;pollingDuplexHttpBinding=非常慢!大延误,wcf,silverlight,pollingduplexhttpbinding,Wcf,Silverlight,Pollingduplexhttpbinding,我有 用于WPF应用程序-->的带有wsDualHttpBinding绑定的WCF运行良好!立即获取WCF发布方法 另一个绑定使用pollingDuplexHttpBinding for silvelight 4-->非常慢-->wpf应用程序获取后延迟30++-秒(wpf立即获取) 为什么呢?谷歌的最佳结果是 我真的不知道如何继续 <system.serviceModel> <!-- Register the binding extension from the

我有

用于WPF应用程序-->的带有wsDualHttpBinding绑定的WCF运行良好!立即获取WCF发布方法

另一个绑定使用pollingDuplexHttpBinding for silvelight 4-->非常慢-->wpf应用程序获取后延迟30++-秒(wpf立即获取)

为什么呢?谷歌的最佳结果是

我真的不知道如何继续

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

步骤一:从服务中删除AspNetCompatibilityRequirements

  [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1 : IService1

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

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

 private void Application_Startup(object sender, StartupEventArgs e)
        {
                WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
                WebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp);
        }
 private void Application_Startup(object sender, StartupEventArgs e)
        {
                WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
                WebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp);
        }