J'ai développé une application de causerie Silverlight. Dans une seule fenêtre, chargez plus d'une fenêtre de chat en même temps et chaque fenêtre de discussion crée une nouvelle connexion au service duplex wcf. Mais après toutes les 10 fenêtres de discussion, il se déconnecte de wcf et le travail est bloqué. Im code un peu pour l'option de limitation, mais ils ne fonctionnent pas. ceci est mon code: -silverlight déconnecter de wcf duplex après 10 connexions
public class PollingDuplexServiceHostFactory : ServiceHostFactoryBase
{
public override ServiceHostBase CreateServiceHost(string constructorString,
Uri[] baseAddresses)
{
return new PollingDuplexSimplexServiceHost(baseAddresses);
}
}
/// <summary>
/// PollingDuplexServiceHostFactory
/// </summary>
class PollingDuplexSimplexServiceHost : ServiceHost
{
public PollingDuplexSimplexServiceHost(params System.Uri[] addresses)
{
InitializeDescription(typeof(JakayaChatService), new UriSchemeKeyedCollection(addresses));
Description.Behaviors.Add(new ServiceMetadataBehavior());
var throttle = Description.Behaviors.Find<ServiceThrottlingBehavior>();
if (throttle == null)
{
throttle = new ServiceThrottlingBehavior
{
MaxConcurrentCalls = 1000,
MaxConcurrentInstances = 1000,
MaxConcurrentSessions = 1000
};
Description.Behaviors.Add(throttle);
}
}
protected override void InitializeRuntime()
{
PollingDuplexBindingElement pdbe = new PollingDuplexBindingElement()
{
ServerPollTimeout = TimeSpan.FromSeconds(05),
InactivityTimeout = TimeSpan.FromSeconds(3600)
};
// Add an endpoint for the given service contract.
this.AddServiceEndpoint(
typeof(IJakayaChatService),
new CustomBinding(
pdbe,
new BinaryMessageEncodingBindingElement(),
new HttpTransportBindingElement()),
"");
// Add a metadata endpoint.
this.AddServiceEndpoint(
typeof(IMetadataExchange),
MetadataExchangeBindings.CreateMexHttpBinding(),
"mex");
base.InitializeRuntime();
}
}