我有 FTP 站点。当我输入错误的用户名/密码时,我在 C:\inetpub\logs\LogFiles 中找不到任何日志。我已检查 FTP 日志记录,它已启用并且路径正确。
答案1
你等了多久?IIS 日志不会立即刷新到磁盘。
看:http://weblogs.asp.net/owscott/archive/2012/02/03/flush-http-and-ftp-logs-in-iis.aspx- 不幸的是,刷新 FTP 日志并不像刷新 HTTP 日志那么简单:
电源外壳:
Param($siteName = "Default Web Site")
#Get MWA ServerManager
[System.Reflection.Assembly]::LoadFrom( "C:\windows\system32\inetsrv\Microsoft.Web.Administration.dll" ) | Out-Null
$serverManager = new-object Microsoft.Web.Administration.ServerManager
$config = $serverManager.GetApplicationHostConfiguration()
#Get Sites Collection
$sitesSection = $config.GetSection("system.applicationHost/sites")
$sitesCollection = $sitesSection.GetCollection()
#Find Site
foreach ($item in $sitesCollection){
if ($item.Attributes.Item("Name").Value -eq $siteName){
$site = $item
}
}
#Validation
if ($site -eq $null) {
Write-Host "Site '$siteName' not found"
return
}
#Flush the Logs
$ftpServer = $site.ChildElements.Item("ftpServer")
if (!($ftpServer.ChildElements.Count)){
Write-Host "Site '$siteName' does not have FTP bindings set"
return
}
$ftpServer.Methods.Item("FlushLog").CreateInstance().Execute()