530 为多个站点设置 IIS 10 时需要有效的主机名

Ada*_*dam 5 iis ftp windows-server-2016

我已使用此处找到的说明将 IIS 配置为具有多个 FTP 站点:https : //docs.microsoft.com/en-us/iis/publish/using-the-ftp-service/using-ftp-virtual-host -names-in-iis-7

请参阅我在下面结束的配置。

在 IIS 中,我已经配置了基本身份验证并使用用户 mysite_ftp 进行“连接为”,在测试设置时,我在身份验证和授权上都得到绿色复选标记。

IIS 设置: 在此处输入图片说明

当我使用 Filezilla 尝试连接时,我得到以下日志:

尝试使用 VPS 主机名:h2746286.stratoserver.net

Status: Resolving address of h2746286.stratoserver.net
Status: Connecting to 85.214.200.30:21...
Status: Connection established, waiting for welcome message...
Status: Insecure server, it does not support FTP over TLS.
Command:    USER tv_ftp
Response:   331 Valid hostname is expected.
Command:    PASS ***********
Response:   503 Login with USER first.
Error:  Critical error: Could not connect to server
Run Code Online (Sandbox Code Playgroud)

尝试使用主机名:www.telefonievergelijken.nl

Status: Resolving address of www.telefonievergelijken.nl
Status: Connecting to 85.214.200.30:21...
Status: Connection established, waiting for welcome message...
Status: Insecure server, it does not support FTP over TLS.
Command:    USER tv_ftp
Response:   331 Valid hostname is expected.
Command:    PASS ***********
Response:   503 Login with USER first.
Error:  Critical error: Could not connect to server
Run Code Online (Sandbox Code Playgroud)

尝试使用主机名:ftp.telefonievergelijken.nl

Status: Resolving address of ftp.telefonievergelijken.nl
Status: Connecting to 85.214.200.30:21...
Status: Connection established, waiting for welcome message...
Status: Insecure server, it does not support FTP over TLS.
Command:    USER tv_ftp
Response:   331 Valid hostname is expected.
Command:    PASS ***********
Response:   503 Login with USER first.
Error:  Critical error: Could not connect to server
Run Code Online (Sandbox Code Playgroud)

应用程序主机配置文件

<sectionGroup name="system.ftpServer">
    <section name="log" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
    <section name="firewallSupport" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
    <section name="caching" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
    <section name="providerDefinitions" overrideModeDefault="Deny" />
    <sectionGroup name="security">
        <section name="ipSecurity" overrideModeDefault="Deny" />
        <section name="requestFiltering" overrideModeDefault="Deny" />
        <section name="authorization" overrideModeDefault="Deny" />
        <section name="authentication" overrideModeDefault="Deny" />
    </sectionGroup>
    <section name="serverRuntime" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
</sectionGroup>

<sites>
    <site name="othersite" id="2">
        <application path="/" applicationPool=".NET v4.5">
            <virtualDirectory path="/" physicalPath="E:\othersite\wwwroot" userName="othersite_web" password="[enc:IISCngProvider:b1dn9+We00KRNWUB6shbPm/hLtBOF2hOG9We5zVgaEmYL5C/fDLxDc3QH9Rnvi79SjeM+Rauk/bQWEBzJnw=:enc]" />
        </application>
        <bindings>
            <binding protocol="http" bindingInformation="*:80:www.othersite.nl" />
            <binding protocol="http" bindingInformation="*:80:othersite.nl" />
        </bindings>
    </site>
    <site name="telefonievergelijken" id="3">
        <application path="/" applicationPool=".NET v4.5">
            <virtualDirectory path="/" physicalPath="E:\telefonievergelijken\wwwroot" userName="tv_web" password="[enc:IISCngProvider:x+PhGwZweUwR53tUgGTdEGui8k4gIJRASehxKVtsPoTtxNIA8aRe8WUwvdLuEdzSQicrJVDwen7e/C6x9qfiFyudqtZYwhXuo=:enc]" />
        </application>
        <bindings>
            <binding protocol="http" bindingInformation="*:80:www.telefonievergelijken.nl" />
            <binding protocol="http" bindingInformation="*:80:telefonievergelijken.nl" />
        </bindings>
        <traceFailedRequestsLogging enabled="true" directory="E:\IISData\LogFiles\FailedReqLogFiles" />
    </site>
    <site name="FTP-othersite" id="1">
        <application path="/">
            <virtualDirectory path="/" physicalPath="E:\othersite\wwwroot" />
        </application>
        <bindings>
            <binding protocol="ftp" bindingInformation="127.0.0.1:21:" />
        </bindings>
        <ftpServer>
            <security>
                <ssl controlChannelPolicy="SslAllow" dataChannelPolicy="SslAllow" />
                <authentication>
                    <basicAuthentication enabled="true" />
                </authentication>
            </security>
        </ftpServer>
    </site>
    <site name="FTP-TV" id="4">
        <application path="/">
            <virtualDirectory path="/" physicalPath="E:\telefonievergelijken\wwwroot" userName="tv_ftp" password="[enc:IISCngProvider:xYxqamuKq02/xUcvZGTdEGui8gh3w6XT0hEegnCMZbVIxeWIOypRIZ1u8UAOG/AJg=:enc]" />
        </application>
        <bindings>
            <binding protocol="ftp" bindingInformation="127.0.0.1:21:www.telefonievergelijken.nl" />
        </bindings>
        <ftpServer>
            <security>
                <ssl controlChannelPolicy="SslAllow" dataChannelPolicy="SslAllow" />
                <authentication>
                    <basicAuthentication enabled="true" />
                </authentication>
            </security>
        </ftpServer>
    </site>
    <siteDefaults>
        <logFile logFormat="W3C" directory="E:\IISData\LogFiles" />
        <traceFailedRequestsLogging directory="E:\IISData\LogFiles\FailedReqLogFiles" />
        <ftpServer>
            <logFile directory="E:\IISData\LogFiles\FTPLogs" />
            <security>
                <authentication>
                    <basicAuthentication enabled="false" />
                </authentication>
            </security>
        </ftpServer>
    </siteDefaults>
    <applicationDefaults applicationPool="DefaultAppPool" />
    <virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>        
Run Code Online (Sandbox Code Playgroud)

更新 1

啊,我已经把127.0.0.1的IP地址改成了我的VPS的外部IP地址。当我尝试连接时,ftp.telefonievergelijken.nl|tv_ftp出现日志错误:

Error:  Could not connect to server
Status: Waiting to retry...
Status: Resolving address of ftp.telefonievergelijken.nl|tv_ftp
Status: Connection attempt failed with "EAI_NONAME - Neither nodename nor servname provided, or not known".
Run Code Online (Sandbox Code Playgroud)

更新 2

更改了连接的用户名设置: 在此处输入图片说明

Dre*_*Dre 9

当配置有两个或多个主机名时,ftp 客户端必须在用户名中发送正确的虚拟主机名和用户名。用竖线符号分隔站点名称和用户: |

www.example.com|MyUser

所以,在你的 FTP 客户端中使用这个作为用户名:

ftp.telefonievergelijken.nl|tv_ftp
Run Code Online (Sandbox Code Playgroud)


BE7*_*77Y 5

您似乎正在尝试使用主机名连接到 FTP 站点,该主机名当前未在 IIS 中的 FTP 站点的任何绑定中配置。

我仅基于您包含的 Filezilla 的错误输出,因为您已经从输出中审查了主机名(即使是示例形式),因此没有更多内容了。

您需要在 FTP 站点上配置与您用来连接到 FTP 站点的主机名匹配的绑定(无论是来自 Filezilla 还是任何其他 FTP 客户端)。

编辑:从您更新的帖子信息中,我注意到您对 FTP 站点的绑定确实配置不正确 - 您目前仅将 FTP 站点绑定到本地主机环回地址 (127.0.0.1)。您需要将它绑定到一个非环回地址,这是外部可路由的。根据您的环境,这可能是您的外部 IP 地址(如果直接映射到服务器)或内部 IP 地址(如果您配置了 NAT)。根据当前信息,我的猜测是您必须配置另一个 FTP 站点,该站点正在拦截这些请求并向您显示无效主机名错误。正确配置此 FTP 站点后,所有功能都应按预期运行。

此外,@Dre 的回答也很重要(所以你也应该对它投赞成票)——如果你有多个 FTP 站点绑定到同一个 IP 地址,你需要在你的 FTP 客户端的“用户”字段中指定主机名格式 hostname|user