我遇到了这个问题:无法建立连接,因为目标计算机主动拒绝了它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;
}
}
}
答案 0 :(得分:2)
看起来您没有在执行代码的计算机上安装或运行ClamWin服务。我在这里写了一些指示来安装它:http://architectryan.com/2011/05/19/nclam-a-dotnet-library-to-virus-scan/。