编程语言
首页 > 编程语言> > c# – .NET HttpListener – 设置浏览器代理时,在收听“https://*.8080”时没有流量?

c# – .NET HttpListener – 设置浏览器代理时,在收听“https://*.8080”时没有流量?

作者:互联网

背景 – 我可以让HttpListener适用于HTTP流量.但是我遇到了HTTPS流量问题.

问题:如何更改下面的代码,以便我的HttpListener实际上可以获取对“https”URL的浏览器请求?

注意 – 目前firefox的代理设置设置为“localhost:8080”,当我在端口8080(“https:// *:8080 /”)上收听流量时,我在firefox中输入了一个HTTPS网址,我得到了没有交通被接走? (当我只听http并输入正常的http url时,它工作正常)

  _httpListener = new HttpListener();
  _httpListener.Prefixes.Add("https://*:8080/");
  _httpListener.Start();

谢谢

解决方法:

MSDN

If you create an HttpListener using
https, you must select a Server
Certificate for that listener.
Otherwise, an HttpWebRequest query of
this HttpListener will fail with an
unexpected close of the connection.

You can configure Server Certificates
and other listener options by using
HttpCfg.exe. See
07001
for more details. The executable is
shipped with Windows Server 2003, or
can be built from source code
available in the Platform SDK.

不确定100%虽然……

标签:c,net,https,ssl,httplistener
来源: https://codeday.me/bug/20190621/1258655.html