I have a client-server application that works using a https connection with a self signed certificate and a Nancy Selfhost server.
After installing the application i run the following scripts to prepeare the server.
- Add SSL Certificate to store
- Check witch ip:ports are configured with netsh http show sslcert
- Remove all registrations with port number 4443 (only if they are found with previous step):
- netsh http del sslcert ipport=0.0.0.0:4443
- netsh http del sslcert ipport=[::]:4443
- netsh http del urlacl url=https://+:4443/
- And then add url reservation with: netsh http add urlacl url=https://+:4443/ user=everyone
- Add SSL Certicates with:
- netsh http add sslcert ipport=0.0.0.0:4443 certhash=XXX appid={XXX}
- netsh http add sslcert ipport=[::]:4443 certhash=XXX appid={XXX}
Then I start the server. The code for starting the self host server is:
public void Start(string baseUrl) {
string url = baseUrl;
Uri uri = new Uri(url);
var uris = new[]
{
new Uri($"{uri.Scheme}://localhost:{uri.Port}"),
};
server = new NancyHost(new CustomBootstrapper(url, Api1, Api2, applicationConfiguration), uris);
server.Start();
}
In this code is the baseURL the Hostname of the machine.
The client server connection works in most cases, but one situation it doesn't. This is when i try to run the the server on a specific computer. It has the following differences from other servers:
- Windows 8
- Pinging the hostname of this returns a IPv6 adress.
When starting the client application, it gives the following error: The underlying connection was closed: Could not establsh trust relationship for the ssl/tls secure channel
Now i'm stuck, because I am not sure why it would not work.