如何允许 vb2005.net 中的 HttpListener 允许外部访问?
如何允许 vb2005.net 中的 HttpListener 允许外部访问?
出于测试目的,我将其设置为使用与我的网络服务器使用的端口相同的端口,因此不存在防火墙问题。
前缀设置为采用端口 80 上的本地主机 领域未设置 AuthenticationSchemes = Net.AuthenticationSchemes.Anonymous
它在计算机本地运行得很好,但无法通过网络上任何其他计算机上的 Web 浏览器访问
How do i allow the HttpListener in vb2005.net to allow outside access?
For testing purposes i have set it up to use the same ports as my webserver uses so there are no firewall issues.
the prefixes are set up to take the localhost on port 80
the realm is unset
AuthenticationSchemes = Net.AuthenticationSchemes.Anonymous
it works just fine locally on the machine, but cant be reached by web browser on any other machine on my network
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该问题可能是由于远程客户端将发送主机标头为“yourmachinename”的请求,而不是“localhost”或 IP 地址。
与 IIS 不同,IIS 处理 localhost 和本地计算机名称以及 IP(除非您显式设置主机标头),而 HttpListener 对它实际响应的请求特别挑剔。
设置侦听器,以便它侦听“yourmachinename”上的请求,然后远程客户端应该能够与其通信。 然后,对于本地测试,请确保从本地主机更改主机,因为这可能不再起作用。
The problem is probably due to the fact that a remote client will send the request with a host header of 'yourmachinename', and not 'localhost' or the IP address.
Unlike IIS, which handles localhost and the local machine name, and the IP all the same (unless you explicitly set host headers), the HttpListener is particularly picky about the request it'll actually respond to.
Set the listener up so that it's listening for requests on 'yourmachinename' and remote clients should then be able to talk to it. Then, for local testing, make sure you change the host from localhost, because that'll probably no longer work.
不要输入主机名,而是使用通配符
http://*:port/path
这将允许外部客户端通过任何主机名进行连接
Instead of typing the hostname, use a wildcard
http://*:port/path
this will allow outside clients to connect via any hostname