开发者

How do I test HttpListener() using localhost?

开发者 https://www.devze.com 2023-02-08 15:41 出处:网络
I\'m working on an app that uses HttpListener() e开发者_高级运维xtensively. So far I\'ve been doing all my testing on an actual network, but I\'m pretty sick of this now.

I'm working on an app that uses HttpListener() e开发者_高级运维xtensively. So far I've been doing all my testing on an actual network, but I'm pretty sick of this now.

I've tried the usual suspects (localhost, 127.0.0.1) with the correct port, but nothing happens.

Is there a setting in Windows somewhere? (Is it obvious I'm a *nix boy normally?)


Both localhost and 127.0.0.1 should work fine.

I suspect you have a firewall (such as Windows Firewall) that's preventing connections on your local box. Disable it while you're doing your testing.


Http.sys (which underpins HttpListener) dies not allow access by default unless you are running as an admin. You can enable this using httpcfg (xp) or netsh (vista, win7 etc).

See also this question

This is separate to the firewall; for external connections you will also need to open a small hole in the firewall.

0

精彩评论

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