我試圖弄清楚爲什麼即使在重新啓動計算機後端口仍在使用!IP端點0.0.0.0:13000已經有一個監聽器。 ?? (使用WCF的TCP)
System.ServiceModel.AddressAlreadyInUseException:在IP端點0.0.0.0:13000上已經有一個偵聽器。如果另一個應用程序已在此端點上偵聽,或者您的服務主機中有多個具有相同IP端點但具有不兼容綁定配置的服務端點,則可能會發生這種情況。 ---> System.Net.Sockets.SocketException:通常只允許使用每個套接字地址(協議/網絡地址/端口) 在System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot,SocketAddress套接字地址) System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.ServiceModel.Channels.SocketConnectionListener.Listen() ---內部異常堆棧跟蹤結束--- at System.ServiceModel.Channels.SocketConnectionListener.Listen () 在System.ServiceModel.Channels.TracingConnectionListener.Listen() 在System.ServiceModel.Channels.ConnectionAcceptor.StartAccepting() 在System.ServiceModel.Channels.ExclusiveTcpTransportManager.OnOpen() 在System.ServiceModel.Channels.Trans portManager.Open(TransportChannelListener channelListener) 在System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback) 在System.ServiceModel.Channels.TcpChannelListener`2.OnOpen(時間跨度超時) 在System.ServiceModel.Channels.CommunicationObject.Open (時間跨度超時) 在System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(時間跨度超時) 在System.ServiceModel.Channels.CommunicationObject.Open(時間跨度超時) 在System.ServiceModel.ServiceHostBase.OnOpen(時間跨度超時) 在系統.ServiceModel.Channels.CommunicationObject.Open(TimeSpan超時) at Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo info) System.Net.Sockets.SocketException(0x80004005):通常只允許使用每個套接字地址(協議/網絡地址/端口) 位於System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot,SocketAddress套接字地址) 在System.ServiceModel.Channels.SocketConnectionListener.Listen System.Net.Sockets.Socket.Bind(端點localEP) ()
你如何找出哪個進程監聽端口(13000)? Netstat在該端口上沒有顯示任何內容。
這裏是我的App.config:
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="SomeTarget.SomeTargetService">
<endpoint address="" binding="customBinding" bindingConfiguration="NetTcpBinding"
contract="SomeTarget.ISomeTargetService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:13000" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<customBinding>
<binding name="NetTcpBinding" sendTimeout="00:05:00" closeTimeout="00:00:30" openTimeout="00:00:30" receiveTimeout="00:05:00">
<transactionFlow />
<binaryMessageEncoding />
<windowsStreamSecurity protectionLevel="None" />
<tcpTransport maxBufferPoolSize="524288"
maxReceivedMessageSize="1024"
maxBufferSize="1024" >
<connectionPoolSettings groupName="default" leaseTimeout="00:05:00"
idleTimeout="00:02:00" maxOutboundConnectionsPerEndpoint="20" />
</tcpTransport>
</binding>
</customBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
防火牆問題? – 2012-03-16 21:25:19
防火牆不應該給你一個AddressAlreadyInUseException。 – Yaur 2012-03-16 21:28:39
什麼都沒發現... – 2012-03-16 21:44:26