0

I am using WCF client server. The WCF Server ist installed on a terminal server. When I am testing it locally everythings work with a local WCF Server.

An unhandled exception of type 'System.ServiceModel.CommunicationException' occurred in mscorlib.dll
Fehler beim Deserialisieren des Textkörpers der Antwortnachricht für Vorgang "MixGas". Es wurde das Endelement "MixGasResult" aus Namespace "http://tempuri.org/" erwartet. Gefunden wurde "Element "b:GasMatrice" aus Namespace "http://schemas.datacontract.org/2004/07/RadaxPpdsLibrary"".


Unbehandelte Ausnahme: System.ServiceModel.CommunicationException: Fehler beim Deserialisieren des Textkörpers der Antwortnachricht für Vorgang "MixGas". Es wurde das Endelement "MixGasResult" aus Namespace "http://tempuri.org/" erwartet. Gefunden wurde "Element "b:GasMatrice" aus Namespace "http://schemas.datacontract.org/2004/07/RadaxPpdsLibrary"". ---> System.Xml.XmlException: Es wurde das Endelement "MixGasResult" aus Namespace "http://tempuri.org/" erwartet. Gefunden wurde "Element "b:GasMatrice" aus Namespace "http://schemas.datacontract.org/2004/07/RadaxPpdsLibrary"".
   bei System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
   bei System.Xml.XmlExceptionHelper.ThrowEndElementExpected(XmlDictionaryReader reader, String localName, String ns)
   bei System.Xml.XmlBaseReader.ReadEndElement()
   bei System.Xml.XmlBaseReader.ReadElementContentAsString()
   bei System.Xml.XmlBinaryReader.ReadElementContentAsString()
   bei System.ServiceModel.Dispatcher.PrimitiveOperationFormatter.DeserializeResponse(XmlDictionaryReader reader, Object[] parameters)
   bei System.ServiceModel.Dispatcher.PrimitiveOperationFormatter.DeserializeReply(Message message, Object[] parameters)
   --- Ende der internen Ausnahmestapelüberwachung ---

I do not know what I shall do. The call ist the following:

   public string MixGas(double incomingMassFlow, string incomingGasInp, double sideMassFlow, string sideGasInp,
        out double outgoingMassFlow, out string outgoingGasInp)
    {
        var result = Channel.MixGas(incomingMassFlow, incomingGasInp, sideMassFlow, sideGasInp,
            out outgoingMassFlow, out outgoingGasInp);

        return result;

    }

The method Channel.MixGas raises this exception. I am using other server methods without any exceptions.

This server config file is:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
    </startup>
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel"
              switchValue="All"
              propagateActivity="true">
        <listeners>
          <add name="traceListener"
               type="System.Diagnostics.XmlWriterTraceListener"
               initializeData= "Traces.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
</configuration>

This is the server configuration in C#:

   serviceHost = new ServiceHost(typeof(RadaxPpdsServerLibrary.RadaxPpdsService));

     var binding = new NetTcpBinding()
    {
        OpenTimeout = new TimeSpan(0, 10, 0),
        CloseTimeout = new TimeSpan(0, 10, 0),
        SendTimeout = new TimeSpan(0, 10, 0),
        ReceiveTimeout = new TimeSpan(0, 10, 0),
        MaxReceivedMessageSize = 1000000,
        MaxBufferSize = 1000000,
        MaxConnections = 100,
        Security =
        {
            Mode = SecurityMode.None,
        }
         // PortSharingEnabled = true
     };

    serviceHost.AddServiceEndpoint(typeof(IRadaxPpdsService), binding, "net.tcp://localhost:60000/RadaxPpdsService/RadaxPpdsEndpoint");
ora
  • 115
  • 1
  • 1
  • 12
  • Enable wcf tracking to find internal exceptions and view specific error messages. Here is the reference of enable wcf trace: https://stackoverflow.com/questions/4271517/how-to-turn-on-wcf-tracing – Theobald Du Jul 09 '21 at 02:17
  • I have added this tracing method now I am confused. I get the erorr in error.svclog 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 '10675199.02:48:05.4775807'. But the client does not raise any exception. – ora Jul 12 '21 at 08:31
  • After adding MaxBufferSize = 1000000, to client the socket connection abort has gone away. The System.ServiceModel.CommunicationException error is still an there. – ora Jul 12 '21 at 09:06
  • Increase the size of maxItemsInObjectGraph in . – Theobald Du Jul 14 '21 at 03:16
  • It works now I have explicitely maxItemsInObjectGraph to 2147483647. It works. Thanks. – ora Jul 21 '21 at 10:15

1 Answers1

0

if you post your config file , it would be great , without your config file it's so hard to find the problem.