0

I use code below:

private class WcfProxy<TService> :
            ClientBase<TService> where TService : class, IContract
        {
            public TService WcfChannel
            {
                get
                {
                    return Channel;
                }
            }
        }

    protected TResult ExecuteCommand<TResult>(Func<TContract, TResult> command)
        where TResult : IDtoResponseEnvelop
    {
        var proxy = new WcfProxy<TContract>();

        try
        {
            var result = command.Invoke(proxy.WcfChannel);
            proxy.Close();
            return result;
        }
        catch (CommunicationException ex)
        {
            proxy.Abort();
            throw new BusinessException(BusinessExceptionEnum.Operational, Properties.Resources.Exception.WcfAdapterBase_CommunicationException_TransportInEnamDataIsInvalid, ex);
        }
        catch (TimeoutException ex)
        {
            proxy.Abort();
            throw new BusinessException(BusinessExceptionEnum.Operational, Properties.Resources.Exception.WcfAdapterBase_TimeoutException, ex);
        }
        catch (Exception)
        {
            proxy.Abort();
            throw;
        }
    }

When the query returns high amount of result i encounter with this message:

The communication object cannot be used for communication because it is in the Faulted state

does exist a way or trick that i observe the result of database query successfully or a way that i divide the result or get part of result?

ali khezri
  • 453
  • 1
  • 4
  • 18

2 Answers2

1

Probably youneed to enlatge maxReceivedMessageSize, or one of other parameters of binding.

You can also enable wcf trace and review it with svcTraceViewer.exe

evgenyl
  • 7,837
  • 2
  • 27
  • 32
0

You get this error:

The communication object cannot be used for communication because it is in the Faulted state.

because you throw an error and it is not handled and gets thrown in the iis pool.

Check this link out: http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fc60cd6d-1df9-47ff-90a8-dd8d5de1f080/ also this is not caused by the large ammount of data: WCF Cannot be used for communication because it is in the Faulted state

Community
  • 1
  • 1
radu florescu
  • 4,315
  • 10
  • 60
  • 92