1

When I set the useHttps property to true, I am not able to reach the server.

The instantiation of the server looks like this:

class Listener
{
    RestServer server;
    public Listener()
    {
        server = new RestServer();

        server.Port = "8137";
        server.UseHttps = true;
    }
}

The server starts, and the console input tells me that it listens on https://localhost:8137, but when I try and make a request (in Fiddler), I get the error message: 502 Fiddler - Connection Failed.

The connection to 'localhost' failed. 
System.Security.SecurityException Failed to negotiate HTTPS connection with server.fiddler.network.https> HTTPS handshake to localhost (for #38) failed. System.IO.IOException Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. < An existing connection was forcibly closed by the remote host 

For me it looks like there is a problem with the HTTPS and perhaps the certificate. But where am I able to specify the certificate?

RasmusG
  • 39
  • 8

1 Answers1

0

Grapevine is build on top of the .NET HttpListener class. What you have already in your original post is sufficient from a code perspective. However, there is more that will need to be done on the machine the server is running on for this to work.

  • See the HttpListener docs, especially the notes at the bottom of the page.

  • There is an excellent writeup on StackOverflow for enabling https support for localhost.

  • If you run into problems like this one, I would suggest searching on StackOverflow, as the issue will have nothing to do with Grapevine, and everything to do with the certificate setup.

Community
  • 1
  • 1
Scott Offen
  • 6,933
  • 3
  • 21
  • 24
  • Yes, I actually realized this afterwards. The problem was that I needed to tell Windows to use the certificate for communication on the given port. This post has the details: http://stackoverflow.com/a/11457719/943170 – RasmusG Mar 29 '17 at 13:16