Jeh*_*hof 6 configuration wcf .net-4.0 .net-4.5
我最近在我的服务器上安装了新的.NET Framework 4.5(以前安装了4.0),System.ServiceModel.AddressAlreadyInUseException当我启动公开WCF端点的Windows服务时,我得到了一个.
System.ServiceModel.AddressAlreadyInUseException:IP端点0.0.0.0:56543上已有一个侦听器.如果有另一个应用程序已在此端点上侦听,或者如果服务主机中有多个服务端点具有相同的IP端点但具有不兼容的绑定配置,则可能会发生这种情况.---> System.Net.Sockets.SocketException:System的System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot,SocketAddress socketAddress)通常只允许使用每个套接字地址(协议/网络地址/端口). System.SServiceModel.Channels.SocketConnectionListener.Listen()中的Net.Sockets.Socket.Bind(EndPoint localEP)---内部异常堆栈跟踪的结束---在System的System.ServiceModel.Channels.SocketConnectionListener.Listen()处.
Service.ServiceModel.Channels.BuclusiveConnectionListener.Listen ()位于System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)的System.ServiceModel.Channels.ExclusiveTcpTransportManager.OnOpen()处于System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)at at Sy中的System.ServiceModel.Channels.ConnectionOrientedTransportChannelListener.OnOpen(TimeSpan超时)的System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan超时)System.ServiceModel.Channels上的System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan超时)处的System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan超时)处的stem.ServiceModel.Channels.TcpChannelListener`2.OnOpen(TimeSpan timeout). System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan超时)上的CommunicationObject.Open(TimeSpan超时),位于Qosit.Infrastructure.UnisServer.OnStart(String [] args)的System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan超时)
我的WCF端点的配置如下所示:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBindingConfiguration" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="5242880" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="MEX">
<serviceMetadata/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MEX" name="MyAssembly.MyNamespace.MyService">
<endpoint address="net.tcp://localhost:56543/MyService"
binding="netTcpBinding" bindingConfiguration="NetTcpBindingConfiguration" contract="MyAssembly.MyNamespace.MyServiceInterface" />
<endpoint address="net.tcp://localhost:56543/MEX" binding="mexTcpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
我认为它与使用相同端口的MEX端点有关,但我不确定如何在升级到.NET Framework 4.5后正确配置它.
WCF是否有更改,以便这些配置引发异常?
Pra*_*raj 16
这是因为在此处记录的netTcp端点和mex端点使用相同端口时存在一些限制,请参阅"使用NetTcpBinding在服务端点和mex端点之间共享端口"部分.在4.0中,默认值为listenBackLog和MaxConnections10.在4.5中,这些默认值被修改为12*ProcessorCount.当您尝试在netTcpBinding和mex端点之间共享端口时,如果您对这两个属性具有不同的值,则会发生此异常.在4.0中,这可以正常工作,因为您已将这些设置为默认值(10),因此这些设置在两个端点上没有差异.但是在4.5中,这些对于netTcp端点保留为10,但计算为12*ProcessorCount.所以例外.
要解决这个问题,有两种方法:
请查看此博客了解更多详情.
| 归档时间: |
|
| 查看次数: |
8706 次 |
| 最近记录: |