2009-08-12 15 views
0

私はSilverlightチャットアプリケーションを開発しました。 1つのウィンドウで同時に複数のチャットウィンドウをロードし、すべてのチャットウィンドウでwcfデュプレックスサービスへの新しい接続を作成します。しかし、10のチャットウィンドウごとにwcfから切断され、仕事は止まってしまいます。 Imはいくつかの絞り込みオプションをコードしていますが、機能しません。これは私のコードです: -10コネクション後にSilverlightがwcf duplexから切断されました

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(); 

    } 
} 

答えて

0

10の接続制限は、通常、オペレーティングシステムに起因します。たとえば、Windows XPでは10の接続制限があります。サーバーオペレーティングシステムでは、運用環境ではさらに多くのアクセスが許可されます。つまり、問題はあなたのdev envに限定され、高級OSに配備されたときには消えてしまうかもしれません。

メモMS: Windows XP Professionalの場合、ネットワーク経由で同時に接続できる他のコンピュータの最大数は10です。この制限には、すべてのトランスポートとリソース共有プロトコルが組み合わされています。 Windows XP Home Editionの場合、ネットワーク経由で同時に接続できる他のコンピュータの最大数は5です。この制限は、システムがホストできる他のコンピュータからの同時セッション数です。この制限は、リモートコンピュータから接続する管理ツールの使用には適用されません。

IISコネクションの制限と最適化 http://blogs.msdn.com/david.wang/archive/2006/04/12/HOWTO-Maximize-the-Number-of-Concurrent-Connections-to-IIS6.aspx

関連する問題