Domanda

Sto sviluppando un listener http per accedere a un processo remoto.Esempio di snippet di codice:

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();
}

Funziona come previsto se utilizzo la porta 8080, ma fallisce sulla porta 443. L'eccezione è

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

Soluzione

Assicurati che ci siano altri siti web (in IIS o Apache) che servono attraverso la porta 443 con SSL?Dovrebbe essere la causa comune del problema segnalato.

Puoi provare qualche altra porta per vedere se la stessa eccezione viene lanciata dall'oggetto HttpListener.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top