Один сервис WCF - два клиента; Один клиент не работает

У меня есть одна служба WCF и два клиента консольного приложения.

Сервис: Сервисный код создается из контакта wsdl с помощью инструмента WCSF Blue.

Клиент 1: Этот клиент использует wsdl, полученный при просмотре файла SVC. Этот просматриваемый файл wsdl немного отличается от файла контракта wsdl.

Клиент 2: Этот клиент создан с использованием исходного контракта wsdl.

Cleint1 работает нормально. Клиент 2 не работает. Какие все могут быть потенциальные проблемы?

Файл App.Config обоих клиентов выглядит одинаково & # x2013; только имя меняется. Думаю, проблема будет в сгенерированном клиентском коде C # & # x2013; скорее всего вAction & # X2013;ReplyAction, Что нужно исправить здесь?

Одно заметное отличие заключается в Action и ReplyAction

Клиент 1:

Action="urn:lijo:demos:multiplyservice:calculation:v1/ICalculationService/GetMultiplied", ReplyAction="urn:lijo:demos:multiplyservice:calculation:v1/ICalculationService/GetMultipliedRe" + "sponse"

Клиент 2:

Action="urn:lijo:demos:multiplyservice:calculation:v1:getMultipliedIn", ReplyAction="*"

Trace Message

The message with Action 'urn:lijo:demos:multiplyservice:calculation:v1:getMultipliedIn' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

EDIT

Это можно исправить, изменив Action и ReplyAction, как показано ниже (Скопировано из Сервиса).

  [System.ServiceModel.OperationContractAttribute(Action = "urn:lijo:demos:multiplyservice:calculation:v1/ICalculationService/getMultiplied", ReplyAction = "urn:lijo:demos:multiplyservice:calculation:v1/ICalculationService/getMultipliedRe" +
        "sponse")]

Примечание. Важно убедиться, что регистр в службе корректен (т. Е. GetMultiplied не GetMultiplied).

Копирование из службы не является хорошим вариантом, хотя он работает. Какими будут правильные Action и ReplyAction?

Кроме того, не могли бы вы указать, какmodify the wsdl so that the ReplyAction will be correct в сгенерированном клиентском прокси? Это важная часть, чтобы пометить его как ответ.

WCF: действия, звездочка и метаданные

WsdlExporter, which is used for metadata publishing, ignores operations with asterisk actions (both Action and ReplyAction).

ОтMSDN -ReplyAction Свойство

Specifying an asterisk in the service instructs WCF not to add a reply action to the message, which is useful if you are programming against messages directly.

REFERENCES:

WCF metadata missing operations

RestaurantData.xsd

 <?xml version="1.0" encoding="utf-8" ?>
 <xs:schema id="RestaurantData" targetNamespace="urn:lijo:demos:multiplyservice:data:v1"
    elementFormDefault="qualified" xmlns="urn:lijo:demos:multiplyservice:data:v1"
    xmlns:mstns="urn:lijo:demos:multiplyservice:data:v1" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:complexType name="multipliedResult">
  <xs:sequence>
  <xs:element name="resultNumber" type="xs:int" />
   </xs:sequence>
   </xs:complexType>

  </xs:schema>

Original Contract wsdl

 <definitions xmlns:import0="urn:lijo:demos:multiplyservice:messages:v1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:import1="urn:lijo:demos:multiplyservice:data:v1" xmlns:tns="urn:lijo:demos:multiplyservice:calculation:v1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="CalculationService" targetNamespace="urn:lijo:demos:multiplyservice:calculation:v1" xmlns="http://schemas.xmlsoap.org/wsdl/">

 <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
 <types>
 <xsd:schema>
  <xsd:import schemaLocation="C:\toolbox\LijosServiceApp\NewService\RestaurantMessages.xsd" namespace="urn:lijo:demos:multiplyservice:messages:v1" />
  <xsd:import schemaLocation="C:\toolbox\LijosServiceApp\NewService\RestaurantData.xsd" namespace="urn:lijo:demos:multiplyservice:data:v1" />
</xsd:schema>
</types>
<message name="getMultipliedIn">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
<part name="parameters" element="import0:getMultiplied" />
</message>
<message name="getMultipliedOut">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
<part name="parameters" element="import0:getMultipliedResponse" />
</message>
<portType name="CalculationServiceInterface">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
<operation name="getMultiplied">
  <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
  <input message="tns:getMultipliedIn" />
  <output message="tns:getMultipliedOut" />
</operation>
</portType>
<binding name="BasicHttpBinding_CalculationServiceInterface" type="tns:CalculationServiceInterface">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="getMultiplied">
  <soap:operation soapAction="urn:lijo:demos:multiplyservice:calculation:v1:getMultipliedIn" style="document" />
  <input>
    <soap:body use="literal" />
  </input>
  <output>
    <soap:body use="literal" />
  </output>
 </operation>
 </binding>
 <service name="CalculationServicePort">
 <port name="CalculationServicePort" binding="tns:BasicHttpBinding_CalculationServiceInterface">
  <soap:address location="http://localhost/CalculationService" />
 </port>
 </service>
 </definitions>

Ответы на вопрос(2)

Ваш ответ на вопрос