【问题标题】:Visual Studio 2013: Debug using IP Address instead of LocalHostVisual Studio 2013:使用 IP 地址而不是 LocalHost 进行调试
【发布时间】:2015-05-15 00:31:24
【问题描述】:

我有一个 WCF REST 服务,它在使用 IISExpress 和这个 url 时可以完美地调试和工作:

http://localhost:<portnumber>

但是,由于各种原因,我需要它也可以与 IIS Express 和 THIS url 一起使用:

http://<ip address>:<portnumber>

当我最初尝试时,我收到 HTTP 错误 400:错误请求。然后我用谷歌搜索到这里:Connecting to Visual Studio debugging IIS Express server over the lan

那个帖子问了完全相同的问题,而答案让我成功了。遵循该线程中所有最优秀的建议,我做了以下事情:

编辑 IISExpress Host.config:

1:打开 %USERPROFILE%\My Documents\IISExpress\config\applicationhost.config 文件。

2:更改了所有 17 行:

<binding protocol="http" bindingInformation="*:8080:localhost" />

改为这样:

<binding protocol="http" bindingInformation="*:8080:*" />

(所有 17 行的端口号都不同)

Visual Studio:

关闭,重新打开,但以管理员身份运行

Windows 防火墙:

添加了相关端口以允许传入连接

CMD:

netsh http add urlacl url=http://*:XXXXX/ user=Everyone

运行该命令,其中 XXXXX 是端口号。

现在,当我开始调试并转到此 URL 时:

http://<ip address>:<portnumber>

我现在得到的不是“HTTP 错误 400:错误请求”,而是“HTTP 错误 503。服务不可用。”

这是进步,因为浏览器现在至少可以访问 IISExpress,对吗?但目前我不确定如何克服这个 503 错误。我一直在谷歌搜索这个错误,但没有什么是特定于我正在尝试做的。

有什么想法吗?

【问题讨论】:

标签: wcf debugging visual-studio-2013 http-status-code-503


【解决方案1】:

想通了。而不是这个:

<binding protocol="http" bindingInformation="*:8080:*" />

改成这样:

<binding protocol="http" bindingInformation="*:8080:" />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-30
    • 2019-01-15
    • 1970-01-01
    • 2013-11-15
    • 2021-07-17
    相关资源
    最近更新 更多