locked
Unrecognized message version. CommunicationException RRS feed

  • Question

  • User-248110449 posted

    Hi Folks,

    Please allow me to request to ask and Please help me to sort out error, Thanks a lot in advace..

    I have one WCF Service reference which is i am redirecting via IHttpHandler on request of some page. for example if we will some page like wcfref.aspx when We will hit this page then it will redirect to http://local/WcfBaseServices/CalculatorService.svc?wsdl.

    Now I making proxy via Service Refrence with

    EndpointAddress epa = new EndpointAddress("http://localhost/SingleService/wcfref.aspx");

    BasicHttpBinding objBinding = new BasicHttpBinding();

    ApplicationService.CalculatorClient objCalculatorClient = new ApplicationService.CalculatorClient(objBinding, epa)

    objCalculatorClient.Add(35, 45)

    it throw error like below 

    System.ApplicationException was unhandled
      Message=Unrecognized message version.
      Source=ClientApplication
      StackTrace:
           at ClientApplication.Program.Main(String[] args) in D:\WCFHost\ClientApplication\Program.cs:line 94
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException: System.ServiceModel.CommunicationException
           Message=Unrecognized message version.
           Source=mscorlib
           StackTrace:
             Server stack trace: 
                at System.ServiceModel.Channels.ReceivedMessage.ReadStartEnvelope(XmlDictionaryReader reader)
                at System.ServiceModel.Channels.BufferedMessage..ctor(IBufferedMessageData messageData, RecycledMessageState recycledMessageState, Boolean[] understoodHeaders, Boolean understoodHeadersModified)
                at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.ReadMessage(ArraySegment`1 buffer, BufferManager bufferManager, String contentType)
                at System.ServiceModel.Channels.HttpInput.DecodeBufferedMessage(ArraySegment`1 buffer, Stream inputStream)
                at System.ServiceModel.Channels.HttpInput.ReadBufferedMessage(Stream inputStream)
                at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception& requestException)
                at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
                at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
                at System.ServiceModel.Dispatcher.RequestChannelBinder.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 ClientApplication.ApplicationService.ICalculator.Add(Double firstNumber, Double secondNumber)
                at ClientApplication.ApplicationService.CalculatorClient.Add(Double firstNumber, Double secondNumber) in D:\WCFHost\ClientApplication\Service References\ApplicationService\Reference.cs:line 62
                at ClientApplication.Program.Main(String[] args) in D:\WCFHost\ClientApplication\Program.cs:line 69
           InnerException: 


    Wednesday, April 3, 2013 2:45 AM

Answers

  • User220959680 posted

    StackTrace:
           at ClientApplication.Program.Main(String[] args) in D:\WCFHost\ClientApplication\Program.cs:line 94

    Enable tracing and use Fiddler to step through the implementation locally.

    //Traces can be utilised for trouble shooting. Add below in WCF service configuration and open this trace //file using WCF Trace Viewer.
    
    <system.diagnostics>
      <sources>
          <source name="System.ServiceModel.MessageLogging"
                   switchValue="Information, ActivityTracing, Error">
            <listeners>
                     <add name="messages"
                     type="System.Diagnostics.XmlWriterTraceListener"
                     initializeData="messages.svclog" />
              </listeners>
          </source>
        </sources>
    </system.diagnostics>
    
    
    
      <system.serviceModel>
      
        <diagnostics>
        <messageLogging
             logEntireMessage="true"
             logMalformedMessages="true"
             logMessagesAtServiceLevel="true"
             logMessagesAtTransportLevel="true"
             maxMessagesToLog="3000"
             maxSizeOfMessageToLog="2000"/>
      </diagnostics>



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 3, 2013 6:47 AM