Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
Definisce le informazioni per l'attività FTP, ad esempio nome utente, ID sessione, indirizzi IP per il client e il server. Gli sviluppatori possono selezionare le informazioni di registrazione da usare quando implementano l'interfaccia IFtpLogProvider.
Sintassi
struct LOGGING_PARAMETERS
{
LPWSTR pszSessionId;
LPWSTR pszSiteName;
LPWSTR pszUserName;
LPWSTR pszHostName;
LPWSTR pszRemoteIpAddress;
unsigned long dwRemoteIpPort;
LPWSTR pszLocalIpAddress;
unsigned long dwLocalIpPort;
unsigned __int64 BytesSent;
unsigned __int64 BytesReceived;
LPWSTR pszCommand;
LPWSTR pszCommandParameters;
LPWSTR pszFullPath;
unsigned long dwElapsedMilliseconds;
unsigned long FtpStatus;
unsigned long FtpSubStatus;
HRESULT hrStatus;
LPWSTR pszInformation;
};
Members
| Nome membro | Definizione |
|---|---|
| BytesReceived | Numero di byte ricevuti dal client. |
| BytesSent | Numero di byte inviati al client. |
| pszCommand | Comando FTP. |
| pszCommandParameters | Parametri correlati al comando FTP. |
| dwElapsedMilliseconds | Numero di millisecondi impiegato per il completamento dell'operazione. |
| FtpStatus | Stato FTP del comando corrente. |
| FtpSubStatus | Stato secondario FTP del comando corrente. |
| pszFullPath | Percorso completo dell'operazione per il comando FTP. |
| pszHostName | Nome host virtuale FTP. |
| hrStatus | Codice di errore di Windows per l'operazione. |
| pszInformation | Informazioni aggiuntive sulla risoluzione dei problemi per il comando. |
| pszLocalIpAddress | Indirizzo IP locale a cui è connesso il client. |
| dwLocalIpPort | Porta TCP/IP del server. |
| pszRemoteIpAddress | Indirizzo IP del client. |
| dwRemoteIpPort | Porta TCP/IP del client. |
| pszSessionId | ID sessione. |
| pszSiteName | Nome dell'istanza del server da registrare. |
| pszUserName | Nome dell'utente. |
Esempio
Nell'esempio di codice seguente viene illustrato come usare l'interfaccia IFtpLogProvider per creare un modulo di registrazione personalizzato per il servizio FTP.
public:
STDMETHOD(Log)(LOGGING_PARAMETERS * pLoggingParameters)
{
// Note: You would add your own custom logic here.
HRESULT hr = S_OK;
DWORD dwResult;
HANDLE hFile;
char szLogEntry[256]="";
const DWORD FILE_WRITE_TO_END_OF_FILE = 0xffffffff;
OVERLAPPED Overlapped = { 0 };
Overlapped.Offset = FILE_WRITE_TO_END_OF_FILE;
Overlapped.OffsetHigh = -1;
// Retrieve the current date and time for the log entry.
SYSTEMTIME CurrentTime;
GetSystemTime(&CurrentTime);
// Open the log file for output.
hFile = CreateFile(
L"\\\\?\\C:\\logfiles\\myftpsite\\myftplog.log",
GENERIC_WRITE,
FILE_SHARE_READ,
NULL,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH,
NULL);
// Return an error if a failure occurs.
if (hFile == INVALID_HANDLE_VALUE)
{
hr = HRESULT_FROM_WIN32(GetLastError());
goto EXIT;
}
// Format the log entry.
hr = StringCchPrintfA(
szLogEntry,256,
"%04d-%02d-%02d\t%02d:%02d:%02d\t%S\t%d\r\n",
CurrentTime.wYear,CurrentTime.wMonth,CurrentTime.wDay,
CurrentTime.wHour,CurrentTime.wMinute,CurrentTime.wSecond,
pLoggingParameters->pszCommand,
pLoggingParameters->FtpStatus);
// Test for error.
if (FAILED(hr))
{
// Return the error if a failure occurs.
hr = HRESULT_FROM_WIN32(GetLastError());
goto EXIT;
}
// Write the log entry to the log file.
if(!WriteFile(hFile, szLogEntry,
strlen(szLogEntry), &dwResult, &Overlapped))
{
// Return an error if a failure occurs.
hr = HRESULT_FROM_WIN32(GetLastError());
goto EXIT;
}
EXIT:
// Close the log file if it is open.
if(CloseHandle(hFile)==0)
{
// Return an error if a failure occurs.
hr = HRESULT_FROM_WIN32(GetLastError());
}
return hr;
}
Requisiti
| Tipo | Descrizione |
|---|---|
| Client | - IIS 7.5 in Windows 7 - IIS 8.0 in Windows 8 - IIS 10.0 in Windows 10 |
| Server | - IIS 7.5 in Windows Server 2008 R2 - IIS 8.0 in Windows Server 2012 - IIS 8.5 in Windows Server 2012 R2 - IIS 10.0 in Windows Server 2016 |
| Prodotto | - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 |
| Riferimento | ftpext.tlb |