Answered System.ServiceModel.FaultException`1

  • Monday, August 06, 2012 5:50 AM
     
      Has Code

    Hi,

    Any general causes for the exception below?

    System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: The value of this argument must fall within the range 0 to 4.
    Parameter name: headerIndex
    Actual value was -1. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
    System.ArgumentOutOfRangeException: The value of this argument must fall within the range 0 to 4.
    Parameter name: headerIndex
    Actual value was -1.
       at System.ServiceModel.Channels.MessageHeaders.GetReaderAtHeader(Int32 headerIndex)
    

    Thanks,

    Regards,

    Murtaza.

All Replies

  • Monday, August 06, 2012 9:20 AM
     
     
    You're not giving us enough information to help you.
    • Edited by Pantelis.Ar Monday, August 06, 2012 9:24 AM
    •  
  • Monday, August 06, 2012 11:58 AM
     
     Answered Has Code

    Hi,

    I took a deeper look at the exception till the end

     
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.AfterReceiveRequestCore(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.AfterReceiveRequest(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)).}

    Commenting in the web.config

    the sections describing TCP endpoint and binding solves this.

       <!--<netTcpBinding>
            <binding name="EndPointTCP" />
          </netTcpBinding>-->
     <!--<endpoint address="net.tcp://localhost/WCF/Service1.svc"
            binding="netTcpBinding" bindingConfiguration="EndPointTCP" contract="Class1.IServ"
            name="EndPointTCP">
            <identity>
              <servicePrincipalName value="host/localhost" />
            </identity>
          </endpoint>-->

    The reason is that the only protocol enabled is HTTP hence

    only http endpoint is permitted.

     

    Thanks,

    Regards.


    • Edited by murtazagandhi Thursday, August 09, 2012 6:53 AM correction
    • Marked As Answer by murtazagandhi Thursday, August 09, 2012 6:57 AM
    •  
  • Monday, August 06, 2012 12:25 PM
     
     
    Post the service code on which the exception is thrown and your configuration.
  • Monday, August 06, 2012 12:47 PM
     
     

    I suppose that some code on your service is handling message headers incorrectly. There are 5 message headers available, and the code specifies incorrect header index. Try searching your solution by "GetReaderAtHeader". Also try attaching a debuger to your WCF service.