Действие не может быть обработано из-за несоответствия ContractFilter в EndpointDispatcher
Я пытаюсь запустить простой веб-сервис, который отправляет электронные письма после запуска, но я получаю следующую ошибку при попытке установить его:
Сообщение с действием 'localhost/IFabricService/StartMailRun' не может быть обработано в получателе из-за несоответствия ContractFilter в EndpointDispatcher. Это может быть связано либо с несоответствием контракта (несоответствующие действия между отправителем и получателем), либо с несоответствием привязки / безопасности между отправителем и получателем. Убедитесь, что отправитель и получатель имеют одинаковый контракт и одинаковую привязку (включая требования безопасности, например, Message, Transport, None).'.
Мой сервис закодирован следующим образом:
namespace Project.Fabric
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
public interface IFabricService
{
[OperationContract(IsOneWay=true)]
void StartMailRun(int id, string customerGuid);
}
// Use a data contract as illustrated in the sample below to add composite types to service operations.
[DataContract]
public class CompositeType
{
bool boolValue = true;
string stringValue = "Hello ";
[DataMember]
public bool BoolValue
{
get { return boolValue; }
set { boolValue = value; }
}
[DataMember]
public string StringValue
{
get { return stringValue; }
set { stringValue = value; }
}
}
}
Это вызывается из библиотеки классов, которая называется Project.Biz, а файл называется EmailBiz.cs, используя следующий код:
public void StartEmailRun(int id)
{
WS2007HttpBinding myBinding = new WS2007HttpBinding();
myBinding.Security.Mode = SecurityMode.TransportWithMessageCredential;
myBinding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate;
// Create the endpoint address.
EndpointAddress ea = new EndpointAddress("https://fabric.metalearning.net/FabricService.svc");
// Create the client.
MetaLearning.Fabric.Console.ServiceReference1.FabricServiceClient svc = new MetaLearning.Fabric.Console.ServiceReference1.FabricServiceClient(myBinding, ea);
// Specify a certificate to use for authenticating the client.
svc.ClientCredentials.ClientCertificate.SetCertificate(
StoreLocation.LocalMachine,
StoreName.My,
X509FindType.FindByThumbprint,
"thumbprinthere");
// Begin using the client.
try
{
svc.Open();
//this will need changed to include correct string of GUID and correct ID for email campaign.
svc.StartMailRun(id, "a67f8076-82c6-427c-ac34-fb34aee59e0b");
System.Console.ReadLine();
// Close the client.
svc.Close();
}
catch (Exception ex)
{
}
}
Web.config сервиса Fabric выглядит следующим образом:
<system.serviceModel>
<services>
<service behaviorConfiguration="ServiceCredentialsBehaviour" name="MetaLearning.Fabric.FabricService">
<endpoint binding="ws2007HttpBinding" bindingConfiguration="WSHttpBinding_IFabricService" name="SecuredByClientCertificate" contract="MetaLearning.Fabric.IFabricService" />
</service>
</services>
<bindings>
<ws2007HttpBinding>
<binding name="WSHttpBinding_IFabricService">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="Certificate" />
</security>
<!--<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="Certificate" algorithmSuite="Default" />
</security>-->
</binding>
</ws2007HttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceCredentialsBehaviour">
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceMetadata httpsGetEnabled="true" />
<serviceCredentials>
<serviceCertificate findValue="thumbprinthere" x509FindType="FindByThumbprint" storeLocation="LocalMachine" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="ws2007HttpBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />
Может кто-нибудь увидеть, что я упускаю из виду, что будет причиной этой проблемы?