0

我遇到了这个问题:无法建立连接,因为目标机器主动拒绝了它 127.0.0.1:3310。

using System;
using System.Linq;
using nClam;

class Program
{
    static void Main(string[] args)
    {

        var clam = new ClamClient("localhost", 3310);
        var scanResult = clam.ScanFileOnServer(@"C:\inetpub\wwwroot\rarextract\parts\eicar_com.zip");  //any file you would like!

        switch(scanResult.Result)
        {
            case ClamScanResults.Clean:
                Console.WriteLine("The file is clean!");
                break;
            case ClamScanResults.VirusDetected:
                Console.WriteLine("Virus Found!");
                Console.WriteLine("Virus name: {0}", scanResult.InfectedFiles.First().VirusName);
                break;
            case ClamScanResults.Error:
                Console.WriteLine("Woah an error occured! Error: {0}", scanResult.RawResult);
                break;
        }
    }
}
4

1 回答 1

2

您似乎没有在执行代码的机器上安装或运行 ClamWin 服务。我在这里写了一些安装说明:http: //architectryan.com/2011/05/19/nclam-a-dotnet-library-to-virus-scan/

于 2015-08-04T04:00:20.993 回答