更改IIS Express的URL?

时间:2018-07-22 16:17:59

标签: iis-express

我希望IIS Express可以为文件夹提供服务器。在输出中,我得到:

Successfully registered URL "http://localhost:8080/" for site "Development Web Site" application "/"

我想更改URL。我发现最接近的是applicationhost.config中的以下内容:

    <site name="Development Web Site" id="1" serverAutoStart="true">
        <application path="/">
            <virtualDirectory path="/" physicalPath="%IIS_BIN%\AppServer\empty_wwwroot" />
        </application>
        <bindings>
            <binding protocol="http" bindingInformation=":8080:localhost" />
        </bindings>
    </site>

如果将localhost更改为“ localhost.test.com”,我仍然会看到一条消息,表明正在注册的URL是“ localhost”。我想念什么吗?

1 个答案:

答案 0 :(得分:0)

这是Microsoft进行绑定的示例。

<binding protocol="http" bindingInformation="127.0.0.1:8080:localhost.test.com" />

https://docs.microsoft.com/en-us/iis/configuration/system.applicationhost/sites/sitedefaults/bindings/binding

如果您打算使其运行,请启用功能齐全的IIS。这是Windows 10的示例。 https://msdn.microsoft.com/en-us/library/ms181052(v=vs.80).aspx

最后,如果要更改URL,可以使用URL重写功能: https://blogs.msdn.microsoft.com/friis/2016/08/25/setup-iis-with-url-rewrite-as-a-reverse-proxy-for-real-world-apps/

如果您尝试转到localhost.test.com,则DNS可能会将您指向test.com,而不是留在服务器中,除非您更新主机文件,否则这很奇怪,所以我不不建议这样做。