[英]WCF listenBacklog and maxConnections can't be set higher than 10. Why not?
[英]WCF maxConnections property
我有一個用.net 4編寫的WCF服務,並通過net.tcp公開。 每當我嘗試將綁定配置的MaxConnections屬性設置為高於10的值時,我就是AddressAlreadyInUseException。
為什么會被拋到MaxConnection設置?
(如果重要的話,我使用的是帶有4核CPU和4 GB RAM的Server 2008 R2 Standard)
<binding name="NetTcpBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
transferMode="Buffered" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxBufferSize="25000000"
maxReceivedMessageSize="25000000" maxConnections="50">
<readerQuotas maxDepth="32" maxStringContentLength="25000000"
maxArrayLength="25000000" maxBytesPerRead="25000000" maxNameTableCharCount="25000000" />
<security mode="None" />
</binding>
<service behaviorConfiguration="ApiService.ServiceBehavior" name="Api.Service.PlatformApiService">
<endpoint
address="/Search"
binding="netTcpBinding"
bindingConfiguration="NetTcpBinding"
contract="IApiService" />
<endpoint
address="mex"
binding="mexTcpBinding"
bindingConfiguration="NetTcpBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8094/Api/" />
</baseAddresses>
</host>
</service>
您的mex端點定義的綁定配置不屬於您的配置代碼段。
MaxConnection定義給定端口的連接池。 目前,您正在使用兩個共享單個端口的端點--ApiService和Metadata端點。 在更改綁定配置中的設置之前,兩個enpoints都使用默認值 - 池中的10個連接。 當您更改它只影響一個端點的值時,第二個端點仍然需要10個連接=>異常。 解決方案是:
至少第一個想法應該有效。
<endpoint
address="mex"
binding="netTcpBinding"
bindingConfiguration="NetTcpBinding"
contract="IMetadataExchange" />
使用binding =“netTcpBinding”,而不是mexTcpBinding,因此兩個端點可以使用相同的netTcpBinding配置。 maxConnections值可以相同!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.