开发者

Http Listener doesn't work on Port 8080 or other ports (works only on port 80)

I wrote a simple WebServer using HttpListener class (.net 2.0)

It seems that It doesn't work on port other then 80.

When i sniff the transport to my server i can see the Syn packets on Port 8080 arrive to the server, but there is no Syn/Ack response, although when i sue netstat -a i can see that the server is listening to port 8080 (i verified that my application is the one that listens)

HttpListener server = new HttpListener()
server.Prefixes.Add("http://192.168.4.133:8080/");
server.Start();
_log.Write("Waiting for a connection... ");
HttpListenerContext context = server.GetContext();
HttpListenerRequest request = context.Request;
HttpL开发者_运维知识库istenerResponse response = context.Response;
_log.Write("Got request for " + request.RawUrl);

the above code doesn't receive any Context (stuck at the line server.GetContext()) if i change the Prefix to "http://192.168.4.133/" the above code works perfectly.

when i am testing it on Port 80, i am killing the IIS services, and making sure that my application is the one that listen to the relevant port.

i am running this on XP, so i don't think it is security issues....but you never know.. i have read about the httpcfg tool, but didnt really understood it...

is there something inherntly diffrent between listening on port 80 to listening on other ports? 8080 or even better another random user port? Thanks, Itay


I'd suggest checking your firewall, and if you don't find anything -- try to run another server on 8080 and check if it's working (so you know that it's the port, not the server).


Check if you're firewall is on or off and if on, whether prohibiting this port access. You can termorarily turn it of for the test just to make sure.

Side note: No need to be hunting down and killing IIS processes, simply stop the IIS windows service (run the command "services.msc" to see a list)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜