我遇到了一个与Windows Server 2008 R2 Standard 上的IIS 7.5 FTP IIS 管理器用户登录失败 (530)非常相似的问题。
我已经创建了一个 FTP 站点和 IIS 管理器用户,但登录时遇到问题。我真的可以通过使用 IIS 管理器用户而不是通过创建新的系统用户来实现这一点,因为我对这些帐户有相当的限制。
这是通过命令提示符本地连接时的输出:
C:\Windows\system32>ftp localhost
Connected to MYSERVER.
220 Microsoft FTP Service
User (MYSERVER:(none)): MyFtpLogin
331 Password required for MyFtpLogin.
Password: ***
530-User cannot log in.
Win32 error: Logon failure: unknown user name or bad password.
Error details: An error occured during the authentication process.
530 End
Login failed.
Run Code Online (Sandbox Code Playgroud)
我按照指南配置FTP与IIS管理器身份验证在IIS 7中,并在IIS 7中添加FTP发布到一个网站
我做过和检查过的事情:
这是与 FTP 站点关联的 applicationHost 配置文件的一部分
<site name="MySite" id="8">
<application path="/" applicationPool="MyAppPool">
<virtualDirectory path="/" physicalPath="D:\Websites\MySite" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:www.mydomain.co.uk" />
<binding protocol="ftp" bindingInformation="*:21:www.mydomain.co.uk" />
</bindings>
<ftpServer>
<security>
<ssl controlChannelPolicy="SslAllow" dataChannelPolicy="SslAllow" />
<authentication>
<basicAuthentication enabled="true" />
<customAuthentication>
<providers>
<add name="IisManagerAuth" enabled="true" />
</providers>
</customAuthentication>
</authentication>
</security>
</ftpServer>
</site>
...
<location path="MySite">
<system.ftpServer>
<security>
<authorization>
<add accessType="Allow" users="MyFtpLogin" permissions="Read, Write" />
</authorization>
</security>
</system.ftpServer>
</location>
Run Code Online (Sandbox Code Playgroud)
如果我使用相同的 IIS 管理器帐户详细信息从本地 IIS 管理器连接到站点(而不是 FTP),那么它连接正常,我可以像在本地一样浏览文件和更改设置(尽管我似乎没有选择上传文件)。通过浏览器或 FileZilla 等尝试通过 FTP 连接...给了我:
Status: Resolving address of www.mydomain.co.uk
Status: Connecting to 123.456.12.123:21...
Status: Connection established, waiting for welcome message...
Response: 220 Microsoft FTP Service
Command: USER MyFtpLogin
Response: 331 Password required for MyFtpLogin.
Command: PASS *********
Response: 530 User cannot log in.
Error: Critical error
Error: Could not connect to server
Run Code Online (Sandbox Code Playgroud)
我曾尝试收集 ftp 会话的 etw 跟踪,在日志中我得到一个 FailBasicLogon,然后是一个 FailCustomLogon,但没有其他信息:
FailBasicLogon SessionId={cad26a97-225d-45ba-ab1f-f6acd9046e55} | ErrorCode=0x8007052E
StartCustomLogon SessionId={cad26a97-225d-45ba-ab1f-f6acd9046e55} | LogonProvider=IisManagerAuth
StartCallProvider SessionId={cad26a97-225d-45ba-ab1f-f6acd9046e55} | provider=IisManagerAuth
EndCallProvider SessionId={cad26a97-225d-45ba-ab1f-f6acd9046e55}
EndCustomLogon SessionId={cad26a97-225d-45ba-ab1f-f6acd9046e55}
FailCustomLogon SessionId={cad26a97-225d-45ba-ab1f-f6acd9046e55} | ErrorCode=0x8007052E
FailFtpCommand SessionId={cad26a97-225d-45ba-ab1f-f6acd9046e55} | ReturnValue=0x8007052E | SubStatus=ERROR_DURING_AUTHENTICATION
Run Code Online (Sandbox Code Playgroud)
在正常的 FTP 日志中,我只得到:
2012-10-23 16:13:11 123.456.12.123 - 123.456.12.123 21 ControlChannelOpened - - 0 0 e2d4e935-fb31-4f2c-af79-78d75d47c18e -
2012-10-23 16:13:11 123.456.12.123 - 123.456.12.123 21 USER MyFtpLogin 331 0 0 e2d4e935-fb31-4f2c-af79-78d75d47c18e -
2012-10-23 16:13:11 123.456.12.123 - 123.456.12.123 21 PASS *** 530 1326 41 e2d4e935-fb31-4f2c-af79-78d75d47c18e -
2012-10-23 16:13:11 123.456.12.123 - 123.456.12.123 21 ControlChannelClosed - - 0 0 e2d4e935-fb31-4f2c-af79-78d75d47c18e -
Run Code Online (Sandbox Code Playgroud)
如果有人有任何想法,我将不胜感激。非常感谢。
因此,在经历了许多失去的时间之后,我带着新的眼光和灵魂中的新火焰回到了这个话题。看来我有点过于关注新 FTP 站点的设置,而很少关注其他影响。
事实证明,有一个全局“默认 FTP 站点”正在捕获端口 21 上的所有 FTP 请求,因为用户没有添加到该站点的授权帐户列表中,所以它返回了未经授权的响应。
将用户添加到默认 FTP 站点使我能够登录,但随后我被放入默认站点的 FTP 根目录(类似于http://forums.iis.net/t/1156913.aspx)。将登录更改为<hostheader>|<username>也不起作用并返回530 Valid hostname is expected响应。
在我的头在桌子上撞了几次之后,我回去检查并重新检查每一个设置。通常,最终证明是站点绑定中设置的主机标头名称中的拼写错误。<hostheader>|<username>一旦拼写错误被修复,使用随后的登录就可以了。
总之
<hostheader>|<username>,以便 IIS 能够选择我想要登录的站点