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

时间:2012-02-21 05:05:05

标签: 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(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

1 个答案:

答案 0 :(得分:3)

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

您可以尝试使用其他端口查看HttpListener对象是否抛出相同的异常。