Windows-Server-2008-R2

FTP IIS 日誌文件不起作用?

  • January 9, 2014

我有 FTP 站點。當我輸入錯誤的使用者名/密碼時,我在 C:\inetpub\logs\LogFiles 中找不到任何日誌。我已經檢查過,FTP 日誌記錄,它已啟用並且路徑是正確的。

你等了多久?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()

引用自:https://serverfault.com/questions/566055