I was trying to login using the SOAP web service in .NET Core. When I call the Login method, I get the error the below error.
message with Action ‘http://videoos.net/2/XProtectCSServerCommand/Login’ 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).
I have used basic authentication using basic http binding. Here is the code snippet.
var basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
basicHttpBinding.Security.Mode = BasicHttpSecurityMode.Transport;
var uri = new Uri($"[https://localhost:443/ManagementServer/ServerCommandService.svc](https://localhost:443/ManagementServer/ServerCommandService.svc)");
// Create Soap class from interface
var CServer = new ServerCommandServiceSoapClient(basicHttpBinding, new EndpointAddress(uri));
CServer.ClientCredentials.UserName.UserName = <my basic user name>;
CServer.ClientCredentials.UserName.Password = <my basic user passowrd>;
CServer.ClientCredentials.ServiceCertificate.SslCertificateAuthentication = new X509ServiceCertificateAuthentication()
{
CertificateValidationMode = X509CertificateValidationMode.None,
};
using (new OperationContextScope(CServer.InnerChannel))
{
var info = CServer.LoginAsync(Guid.NewGuid(), string.Empty).GetAwaiter().GetResult();
}
What am I missing? It works fine in a .NET FW project. But fails in .NET Core.