Nclam防病毒程序不能与.net应用程序一起工作
本文关键字:应用程序 一起 工作 net 防病毒程序 不能 Nclam | 更新日期: 2023-09-27 18:06:06
我遇到这个问题:无法建立连接,因为目标机器主动拒绝它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;
}
}
}
看起来您没有在执行代码的机器上安装或运行ClamWin服务。我在这里写了一些安装说明:http://architectryan.com/2011/05/19/nclam-a-dotnet-library-to-virus-scan/.