Using the following code:
HttpListener listener = new HttpListener();
//listener.Prefixes.Add("http://*:80/");
listener.Prefixes.Add("http://*:8080/");
listener.Prefixes.Add("http://*:8081/");
listener.Prefixes.Add("http://*:8082/");
listener.Start();
HttpListenerContext context = listener.GetContext();
HttpListenerRequest request = context.Request;
The program hangs on the GetContext();
despite loading http (not https) pages in IE and Firefox.
When I uncomment the first line I get the error:
Failed to listen on prefix 'http://*:80/' because it conflicts with an existing registration on the machine.
So how do I listen to a browser's requests?
See Question&Answers more detail:os