【问题标题】:Grapevine restserver not reacheable with useHTTPS无法使用 useHTTPS 访问 Grapevine rest 服务器
【发布时间】:2017-08-11 21:51:12
【问题描述】:

当我将 useHttps 属性设置为 true 时,我无法访问服务器。

服务器的实例化如下所示:

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

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

服务器启动,控制台输入告诉我它正在侦听https://localhost:8137,但是当我尝试发出请求(在 Fiddler 中)时,我收到错误消息: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 

对我来说,HTTPS 和证书可能存在问题。但是我在哪里可以指定证书?

【问题讨论】:

    标签: c# rest https grapevine


    【解决方案1】:

    Grapevine 构建在 .NET HttpListener 类之上。 从代码的角度来看,您在原始帖子中已有的内容就足够了。但是,要使其正常工作,还需要在运行服务器的机器上完成更多工作。

    【讨论】:

    • 是的,我后来真的意识到了这一点。问题是我需要告诉 Windows 使用证书在给定端口上进行通信。这篇文章有详细信息:stackoverflow.com/a/11457719/943170
    猜你喜欢
    • 2016-04-01
    • 2018-10-24
    • 2016-01-04
    • 2014-07-15
    • 1970-01-01
    • 2016-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多