我有一个用.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>
Run Code Online (Sandbox Code Playgroud)
Lad*_*nka 16
您的mex端点定义的绑定配置不属于您的配置代码段.
MaxConnection定义给定端口的连接池.目前,您正在使用两个共享单个端口的端点--ApiService和Metadata端点.在更改绑定配置中的设置之前,两个enpoints都使用默认值 - 池中的10个连接.当您更改它只影响一个端点的值时,第二个端点仍然需要10个连接=>异常.解决方案是:
至少第一个想法应该有效.
| 归档时间: |
|
| 查看次数: |
11967 次 |
| 最近记录: |