IIS FTP 7.5 可扩展性(IFtpLogProvider 并将 FTP 故障记录到事件日志中)

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

问题描述

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

Anyone pretty familiar with FTP 7.5 extensibility in IIS know what I might be doing wrong?

我在实现 IFtpLogProvider 以正常工作以进行自定义日志记录时遇到严重问题.我要做的就是将超出静态阈值的故障记录到事件日志中,并且每隔一段时间进行一次垃圾收集.我试过使用通用字典和提供者,但没有运气,现在即使是这个简单的代码我也无法工作.提供者甚至没有在下面的代码存根中创建事件日志(或者如果我事先创建它,则使用它).所以现在我很困惑.

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.

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

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.

我们将不胜感激任何有关具体建议的帮助,因为即使使用 Robert McMurray 的优秀教程集,我仍然遇到这些问题.顺便说一句,我正在使用托管代码的接口在 2008 R2 机器上运行它.

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.

下面的存根:

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

推荐答案

我遇到了以下问题:

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

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=

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

2) 在注册程序集时,我没有严格遵循 Robert 的建议.我选中了该复选框,这将其保留为身份验证提供程序,而此代码示例不是.我改为启用基本身份验证,禁用匿名身份验证(在我的情况下),并取消选中教程中提到的框 - 清除提供程序列表中的 FtpLoggingDemo 复选框."

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) 我没有使用 AppCmd(或直接修改 applicationHost.config 中的相应部分)来更新 applicationHost.config 中的自定义提供程序部分

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 故障记录到事件日志中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Custom Error Queue Name when using EasyNetQ for RabbitMQ?(使用 EasyNetQ for RabbitMQ 时自定义错误队列名称?)
How to generate password_hash for RabbitMQ Management HTTP API(如何为 RabbitMQ 管理 HTTP API 生成密码哈希)
Rabbitmq Ack or Nack, leaving messages on the queue(Rabbitmq Ack 或 Nack,将消息留在队列中)
Setup RabbitMQ consumer in ASP.NET Core application(在 ASP.NET Core 应用程序中设置 RabbitMQ 消费者)
Specify Publish timeouts in mass transit(指定公共交通中的发布超时)
RabbitMQ asynchronous support(RabbitMQ 异步支持)