I have a problem when consuming a Web service from a console application, I have added the Reference Service (WS) to the project, but when implementing it within the code when it will execute the method of That Web Service sends me the following error:
An unhandled exception of type 'System.ServiceModel.ProtocolException' occurred in mscorlib.dll
Additional information: SOAP header Action was not understood.
I share the AppConfig
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="WSAsistenciaSoap">
<transactionFlow />
<textMessageEncoding />
<httpTransport authenticationScheme="Ntlm" />
</binding>
</customBinding>
<basicHttpBinding>
<binding name="WSAsistenciaSoap">
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="direccion.com"
binding="customBinding" bindingConfiguration="WSAsistenciaSoap"
contract="WSOpenHR.WSAsistenciaSoap" name="WSAsistenciaSoap" />
</client>
</system.serviceModel>
</configuration>
Where it is thundering when:
Cliente.MetodoWS(dato1,dato2);
Note: Authentication is required and according to the documentation I added <customBinding>