[英]WCF >> DUPLEX >> SILVERLIGHT >> pollingDuplexHttpBinding = VERY SLOW ! BIG DELAY
I have 我有
WCF with wsDualHttpBinding binding for WPF applciation --> works good ! 具有wSDualHttpBinding绑定的WCF用于WPF应用->效果很好! get WCF publish mthods immediately.
让WCF立即发布方法。
another binding with pollingDuplexHttpBinding for silvelight 4 --> very slow --> 30++- seconds delay after the wpf application got it ( the WPF gets it immediately ) 在wpf应用程序得到它之后,另一个与pollingDuplexHttpBinding绑定的silvelight 4->非常慢-> 30 ++-秒的延迟(WPF立即得到它)
Why is that ? 这是为什么 ? best google result was
最好的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 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呼叫要慢.aspx
which I didn't really know how to contiune ... 我真的不知道该怎么做...
<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>
Step I : Remove AspNetCompatibilityRequirements from service 步骤一:从服务中删除AspNetCompatibilityRequirements
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1 : IService1
to 至
public class Service1 : IService1
if you set this from Web.config , delete it. 如果从Web.config进行设置,则将其删除。
Step II : using client stack in Silverlight 第二步:在Silverlight中使用客户端堆栈
private void Application_Startup(object sender, StartupEventArgs e)
{
WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
WebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.