WCF maxConnections property

前端 未结 2 506
情书的邮戳
情书的邮戳 2020-12-31 13:05

I have a WCF service written in .net 4, and exposed over net.tcp. Any time I try to set the MaxConnections property of the binding configuration to something higher than 10

相关标签:
2条回答
  • 2020-12-31 13:47
    <endpoint
            address="mex"
            binding="netTcpBinding" 
            bindingConfiguration="NetTcpBinding"
            contract="IMetadataExchange" />
    

    use binding="netTcpBinding", not mexTcpBinding, so the two endpoints can shahre the same netTcpBinding configuration. The maxConnections value can be the same!

    0 讨论(0)
  • 2020-12-31 14:00

    Your mex endpoint defines binding configuration which is not part of your configuration snippet.

    MaxConnection defines pooling of connections for given port. At the moment you are using two endpoints which share single port - ApiService and Metadata endpoints. Before you changes setting in your binding configuration both enpoints used default value - 10 connections in a pool. When you changed the value it affected only one endpoint second endpoint still demands 10 connections => exception. The solutions are:

    • Expose metadata endpoint on different port.
    • Create custom binding for Mex endpoint. Default mexTcpBinding does not allow changing MaxConnections. Set same value for MaxConnection in custom binding.
    • Try to use port sharing.

    At least first idea should work.

    0 讨论(0)
提交回复
热议问题