【问题标题】:HttpListener not listening outside of host computer?HttpListener 不在主机之外监听?
【发布时间】:2012-04-05 04:02:29
【问题描述】:

我可以使用 HttpListener 来监听来自同一台计算机的请求,但我还没有弄清楚如何让它监听外部请求。

我的前缀是: "http://192.168.103.82:5000/"

我也试过: "http://*:5000/"

我可以在浏览器中输入我的本地网络 IP 并获得响应。但是,如果我在同一网络上的另一台计算机上做同样的事情,就没有这样的运气了。

我需要做一些额外的配置吗?这是操作系统特定的问题吗?我正在运行 Windows 7 Home。

【问题讨论】:

    标签: c# .net webserver httplistener


    【解决方案1】:

    您需要允许端口 5000 通过 Windows 防火墙。

    【讨论】:

      【解决方案2】:

      来自命令:netsh http add urlacl

      以下命令可用:

      此上下文中的命令:add cacheparam - 添加 HTTP 服务缓存 参数 add iplisten - 将 IP 地址添加到 IP 侦听列表。 add sslcert - 为 IP 添加 SSL 服务器证书绑定 地址和端口。添加超时 - 将全局超时添加到 服务。 add urlacl - 添加一个 URL 保留条目。附言 C:\Users\dwalker> netsh http 添加 urlacl ?

      用法:添加urlacl [url=] [[用户=] [ [[听=]是|否 [代表=]是|否] | [sddl=] ]

      参数:

      Tag        Value
      url      - The fully qualified URL
      user     - The user or user-group name
      listen   - One of the following values:
                 yes: Allow the user to register URLs. This is the Default value.
                 no: Deny the user from registering URLs
      delegate - One of the following values:
                 yes: Allow the user to delegate URLs
                 no: Deny the user from delegating URLs. This is the default value.
      sddl     - SDDL string that describes the DACL
      

      备注:此命令为非管理员用户保留 URL, 帐户。可以使用 NT 帐户名指定 DACL 使用监听和委托参数或使用 SDDL 字符串。

      例子:

           add urlacl url=http://+:80/MyUri user=DOMAIN\user
           add urlacl url=http://www.contoso.com:80/MyUri user=DOMAIN\user listen=yes
           add urlacl url=http://www.contoso.com:80/MyUri user=DOMAIN\user delegate=no
           add urlacl url=http://+:80/MyUri sddl=...
      

      示例:netsh http add urlacl user=Everyone url="http://192.168.103.82:5000/"

      【讨论】:

        猜你喜欢
        • 2021-07-26
        • 1970-01-01
        • 1970-01-01
        • 2019-06-22
        • 2019-07-04
        • 2016-05-17
        • 1970-01-01
        • 2023-03-03
        • 2016-07-20
        相关资源
        最近更新 更多