WCF: socket connection was interrupted

CommunicationException was unhandled by user code
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 '02:48:04.9840000'.

I tested this application for several months and just saw this error after making a small change to one of the services. It is only a few seconds, so I do not think this is a timeout problem.

InnerException: System.IO.IOException: read operation failed, see internal exception

(Inner) InnerException: System.Net.Sockets.SocketException - An existing connection was forcibly closed by the remote host.

Any suggestions are welcome!

Thanks in advance

+3
source share
6 answers

, , MaxReceivedMessageSize, MaxArrayLength, MaxStringContentLength, .

MaxItemsInObjectGraph, .

+4

, . , ClientBase<T>, Close, ( ClientBase<T> IDisposable, using).

ChannelFactory<T> , -, , ICommunicationObject; Close , .

, (, , ) . , , , " " . Microsoft , .

, , , , . , SvcTraceViewer, Program Files\Microsoft SDKs\Windows\v6.0A\bin Program Files\Microsoft SDKs\Windows\v7.0A\bin. , , SvcTraceViewer File / Add.

+9

, , , , .

, MaxReceivedMessageSize, MaxArrayLength, MaxStringContentLength, MaxItemsInObjectGraph, ...

, , , WCF. , , , System.DBNull , - . DBNull, .

+3

, , , . ( ), . :

using System;

namespace Playground
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            Console.WriteLine((int)new SomeResponse().Enum);
            Console.ReadLine();
        }

        public enum SomeEnum
        {
            Value1 = 1,
            Value2 = 2,
            Value3 = 3
        }

        public class SomeResponse
        {
            public SomeEnum Enum { get; set; }
        }
    }
}

, , .

SomeResponse WCF, , , .

+2

. .

0

- remoteSystem clientSystem

  • / .
  • , - .
  • dev.clientSubsystem.acme dev.clientSubsystem.acme

,

Test-NetConnection -Port 808 -ComputerName dev.remote-system.acme-corp.net-InformationLevel Detailed

It turned out that this error occurred when the clientSystem was configured for authentication using a private certificate ( dev.clientSubsystem.acme), but the certificate does not exist - or in our case referred to an invalid certificate for authentication.

0
source

Source: https://habr.com/ru/post/1770786/


All Articles