Code-Sharp/WampSharp

Publisher channel connects to host with DefaultWampAuthenticationHost but not WampAuthenticationHost.

bharath3719 opened this issue · 2 comments

DefaultWampAuthenticationHost is hosted as an .net core service in IIS.

When we are trying to publish from another application , if we have used DefaultWampAuthenticationHost , the channel gets opened and connected.

If we have used WampAuthenticationHost , then I get this error while opening channel -

The remote certificate is invalid according to the validation procedure.

Q : Where is this 'validation procedure' occurring ? I don't see debugger hitting the service.
How can i resolve this issue ?
Can i provide a certificate to the channel ? Any leads on the same ?

Edit :

I am doing the below
{
IWampChannel channel = factory.ConnectToRealm("realm")
.WebSocketTransport(new Uri("wss://ABCD127026/notifications"))
.SetClientWebSocketOptions(x =>
{
x.RemoteCertificateValidationCallback += new
RemoteCertificateValidationCallback(ValidateCertificate);
}) .JsonSerialization() .Build();

channel.Open().Wait();
}

    static bool ValidateCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
    {
        return true;
    }

But getting this error

System.AggregateException: 'One or more errors occurred. (The server returned status code '503' when status code '101' was expected.)'

darkl commented

See here for details about the error.

See here for information about how to use certificates in ASP.NET Core, including how to enable SSL certificates on IIS.

Elad

darkl commented

See also the code in this issue as an example of how to set the SSL certificate on the client side.