Hey all,
Anyone pretty familiar with FTP 7.5 extensibility in IIS know what I might be doing wrong?
I am having serious trouble getting an implementation of IFtpLogProvider to work correctly for custom logging. All I want to do is log failures beyond a static threshold to the event log, and have garbage collection every so often. I've tried working with a generic dictionary and the provider with no luck, and now even this simple bit of code I can't get working. The provider is not even creating the event log in the code stub below (or using it if I create it beforehand). So now I am deeply confused.
I follow the instructions to register the assembly after it is signed from within VS and I can confirm that it is added to the GAC. Adding it to IIS 7.5 via the Register Custom Providers option seems to be fine, too.
Any help with specific suggestions would be greatly appreciated, as even with the excellent set of tutorials by Robert McMurray I am still having these issues. I am running this on a 2008 R2 box, by the way, using the interface for managed code.
Stub below:
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration.Provider;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Diagnostics.Eventing;
using System.Text;
using Microsoft.Web.FtpServer;
using System.IO;
public class test: BaseProvider, IFtpLogProvider
{
void IFtpLogProvider.Log(FtpLogEntry loggingParameters)
{
if (!EventLog.SourceExists("TEST"))
{
EventLog.CreateEventSource("TEST", "TEST");
}
// Just trying to get anything into this log, like a list of
// USER attempts or something
EventLog.WriteEntry("TEST", loggingParameters.Command);
}
// Mark an IP address for banning.
private void BanAddress(string ipAddress)
{
EventLog.WriteEntry("TEST", ipAddress, EventLogEntryType.Warning, 9010);
}
}