IIS FTP 7.5可扩展性(IFtpLogProvider并将FTP故障记录到事件日志中) [英] IIS FTP 7.5 Extensibility (IFtpLogProvider and logging FTP failures to the event log)

查看:185
本文介绍了IIS FTP 7.5可扩展性(IFtpLogProvider并将FTP故障记录到事件日志中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何熟悉FTP 7.5在IIS中的可扩展性的人都知道我可能做错了什么?



我很难得到IFtpLogProvider的实现为自定义工作正常日志记录。我想要做的就是将超出事件日志静态阈值的故障记录下来,并且每隔一段时间就进行垃圾回收。我尝试过使用通用词典和提供商,但没有运气,现在即使是这样简单的代码我也无法工作。提供者甚至不在下面的代码存根中创建事件日志(或者如果我事先创建它,则使用它)。所以现在我感到非常困惑。



我按照说明在VS中签名后注册程序集,我可以确认它已被添加到GAC中。通过注册自定义提供程序选项将它添加到IIS 7.5似乎也没问题。



任何有关具体建议的帮助都将不胜感激,因为即使使用Robert McMurray的教程我仍然有这些问题。我正在使用托管代码的界面在2008 R2框中运行此操作。



以下存根:

  using System; 
使用System.Collections.Generic;
使用System.Collections.Specialized;
使用System.Configuration.Provider;
使用System.Data;
使用System.Data.SqlClient;
使用System.Diagnostics;
使用System.Diagnostics.Eventing;
使用System.Text;
使用Microsoft.Web.FtpServer;
使用System.IO;

public class test:BaseProvider,IFtpLogProvider
{

void IFtpLogProvider.Log(FtpLogEntry loggingParameters)
{
if(!EventLog。 SourceExists(TEST))
{
EventLog.CreateEventSource(TEST,TEST);
}

//试图将任何东西都加入到这个日志中,比如
// USER尝试的列表
EventLog.WriteEntry(TEST, loggingParameters.Command);

}

//标记禁止的IP地址。
private void BanAddress(string ipAddress)
{
EventLog.WriteEntry(TEST,ipAddress,EventLogEntryType.Warning,9010);
}
}


解决方案

I有以下问题:



1)在IIS中注册此程序集时,我的类名不正确:


$ b

FtpLogging.FtpLogDemo,FtpLoggingDemo ,version = 1.0.0.0,Culture = neutral,PublicKeyToken =

2)在注册程序集时,我没有密切注意Robert的建议。我离开复选框选中,这保持它作为一个身份验证提供程序,该代码示例不是。我保留了基本的auth启用,禁用匿名auth(在我的情况下)和 unchecked 教程中提到的框 - 清除提供程序列表中的FtpLoggingDemo复选框。



3)我没有使用AppCmd(或直接修改applicationHost.config中的相应部分)来更新applicationHost.config中的自定义提供程序部分

 < customFeatures> 
< providers>
< / providers>
< / customFeatures>

做这三件事解决了这个问题。


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);
    }
}

解决方案

I had the following issues:

1) I had an incorrect class name in my registration of this assembly in IIS:

FtpLogging.FtpLogDemo,FtpLoggingDemo,version=1.0.0.0,Culture=neutral,PublicKeyToken=

2) I did not closely follow Robert's advice when registering the assembly. I left the checkbox checked, and this kept it as an authentication provider, which this code sample is not. I instead left basic auth enabled, disabled anonymous auth (in my case), and unchecked the box mentioned in the tutorial -- 'Clear the FtpLoggingDemo check box in the providers list.'

3) I was not using AppCmd (or modifying the appropriate section in applicationHost.config directly) to update the custom providers section in applicationHost.config

<customFeatures>
    <providers>
        <add name="FtpLoggingDemo" enabled="true" />
    </providers>
</customFeatures>

Doing these three things fixed the issue.

这篇关于IIS FTP 7.5可扩展性(IFtpLogProvider并将FTP故障记录到事件日志中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆