Systematix Infotech Systematix Infotech - 5 months ago 27
C# Question

nclam anti virus is not working with .net application

I am getting this issue: No connection could be made because the target machine actively refused it

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\"); //any file you would like!

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

Answer Source

It looks like you do not have the ClamWin service installed or running on the machine that is executing your code. I wrote some directions a to install it here: