Https侦听器.NET在端口443上失败

Https侦听器.NET在端口443上失败,https,httplistener,Https,Httplistener,我正在开发一个http侦听器来访问远程进程。示例代码段: HttpListener listener = new HttpListener(); listener.Prefixes.Add("https://*:443/"); listener.Start(); Console.WriteLine("Listening..."); for (; ; ) { HttpListenerContext ctx = listener.GetContext(); new Thread(new Worker

我正在开发一个http侦听器来访问远程进程。示例代码段:

HttpListener listener = new HttpListener();
listener.Prefixes.Add("https://*:443/");
listener.Start();
Console.WriteLine("Listening...");
for (; ; )
{
HttpListenerContext ctx = listener.GetContext();
new Thread(new Worker(ctx).ProcessRequest).Start();
}
如果我使用端口8080,但在端口443上失败,那么这将按预期工作。例外是

System.Net.HttpListenerException was unhandled
Message=The process cannot access the file because it is being used by another process

请确保是否有任何其他网站(在IIS或Apache中)通过端口443提供SSL服务?这应该是报告问题的常见原因


您可以尝试其他端口,以查看HttpListener对象是否引发了相同的异常。

您好,非常感谢您提供的信息。我使用命令netstat-o-n-a查看已使用的端口列表,发现skype正在使用该端口。删除后,问题得到解决。请在将来缩进您的代码。这将使其他人更容易阅读您的代码。您还需要将ssl证书绑定到端口,请参见以下内容: