WCF CommunicationException System.ServiceModel.Channels.SocketConnection.Write ERROR

时间:2016-09-02 10:27:14

标签: wcf

使用WCF Net TCP,一天内会出现几个错误。

当客户端向服务器发送消息时发生。

ERROR:System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
System.ServiceModel.Channels.SocketConnection.Write(...)
System.ServiceModel.CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:59.7815972'. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout)
   --- End of inner exception stack trace ---

Server stack trace: 
   at System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout)
   at System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout, BufferManager bufferManager)
   at System.ServiceModel.Channels.BufferedConnection.WriteNow(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, BufferManager bufferManager)
   at System.ServiceModel.Channels.BufferedConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout, BufferManager bufferManager)
   at System.ServiceModel.Channels.FramingDuplexSessionChannel.OnSendCore(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.TransportDuplexSessionChannel.OnSend(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.OutputChannel.Send(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.DuplexChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Ting.MultiTenant.ServiceInterface.IUserInterfaceV2Provider.GetDetailPageV2(String metaObjName, String viewName, String formState, String id, String parentId, String detailViewName, Boolean showCard)
   at wcfProxy.Ting_MultiTenant_ServiceInterface_IWcfApi_ClientFactory_.GetDetailPageV2(String metaObjName, String viewName)

2 个答案:

答案 0 :(得分:0)

我认为system.serviceModel下的protocolMapping标签存在一些问题。 希望它有用:)

答案 1 :(得分:0)

我当前的配置:

<bindings>
  <netTcpBinding>
    <binding name="TcpBinding_BeisenPlatformServices" closeTimeout="00:01:00"
             openTimeout="00:01:00" receiveTimeout="12:00:00" sendTimeout="00:01:00"
             transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
             hostNameComparisonMode="StrongWildcard" listenBacklog="1000"
             maxBufferPoolSize="1073741824" maxBufferSize="1073741824" maxConnections="1000"
             maxReceivedMessageSize="1073741824">
      <readerQuotas maxDepth="256" maxStringContentLength="1048576"
                    maxArrayLength="1048576" maxBytesPerRead="1048576" maxNameTableCharCount="1048576" />
      <reliableSession ordered="false" inactivityTimeout="00:20:00"
                       enabled="false" />
      <security mode="None" />
    </binding>
  </netTcpBinding>
  <serviceBehaviors>
    <behavior name="PlatformServiceBehaviors">
      <serviceMetadata httpGetEnabled="True" />
      <serviceDebug includeExceptionDetailInFaults="false" />
      <serviceThrottling maxConcurrentInstances="1000" maxConcurrentCalls="3" maxConcurrentSessions="1000" />
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    </behavior>