首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >System.ServiceModel.CommunicationException

System.ServiceModel.CommunicationException
EN

Stack Overflow用户
提问于 2021-07-08 18:14:33
回答 1查看 63关注 0票数 0

我使用的是WCF客户端服务器。WCF服务器安装在终端服务器上。当我在本地测试它时,所有东西都与本地WCF服务器一起工作。

代码语言:javascript
复制
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 ---

我不知道我该怎么办。调用如下所示:

代码语言:javascript
复制
   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;

    }

方法Channel.MixGas会引发此异常。我正在使用其他服务器方法,没有任何异常。

此服务器配置文件为:

代码语言:javascript
复制
<?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>

这是C#中的服务器配置:

代码语言:javascript
复制
   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");
EN

回答 1

Stack Overflow用户

发布于 2021-07-11 14:04:48

如果你张贴你的配置文件,那就太好了,没有你的配置文件很难找到问题所在。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68299700

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档