Export (0) Print
Expand All

Antivirus Sample Application

The Antivirus sample agent responds to the OnEndOfData and OnSubmittedMessage events and sends the incoming message to an out of process COM server that asynchronously examines the message and returns a modified version of the message.

To download this sample, download the Exchange 2010 Transport Agents SDK from the Microsoft Download Center.

The Antivirus sample agent consists of a Visual Studio .NET 2005 C++ project and a simple Visual Studio .NET 2005 C# project. By default, the files are installed in the directory in which the Microsoft Exchange 2010 Transport Agents SDK is installed, in the \Samples\Antivirus\ folder.

The following are the primary files for the sample:

  • Install.ps1   An Exchange Management Shell script that installs the compiled sample.

  • Install-x64.ps1   An Exchange Management Shell script that installs the compiled sample in a 64-bit environment.

  • Uninstall.ps1    An Exchange Management Shell script that uninstalls the compiled sample.

  • Uninstall-x64.ps1    An Exchange Management Shell script that uninstalls the compiled sample in a 64-bit environment.

  • AntivirusAgent.csproj   The Visual Studio C# project file for the agent.

  • AntivirusService.vcproj   The Visual Studio C++ project file for the service.

  • HubAntivirusAgent.cs   The C# source code that contains the class that derives from the RoutingAgent class.

  • EdgeAntivirusAgent.cs   The C# source code that contains the class that derives from the SmtpReceiveAgent class.

  • ComStream.cs    The C# source code that implements the COM IStream interface over a .NET stream.

  • DotNetStream.cs    The C# source code that implements a .NET stream over a COM IStream.

To build the Antivirus sample agent, you must first install Visual Studio .NET 2008 and the Microsoft .NET Framework version 3.5 on the computer that is running Exchange 2010 that has the Hub Transport server role installed.

After you install the required software, open theAntivirusService.vcproj C++ project by using Visual Studio .NET. Build the project and fix any errors you encounter. This will build AntivirusService.exe and ComInterop.dll.

After you build the antivirus service, open the AntivirusAgent.csproj C# project by using Visual Studio .NET. If it is necessary, update the references to the Microsoft.Exchange.Data.* namespaces. Build the project and fix any errors you encounter.

To install the Antivirus sample agent

  1. Edit the install.ps1 script to make sure that the $EXDIR variable is correctly initialized for your system. The value of the $EXDIR variable should be the path of the Exchange Server 2010 installation directory.

  2. Open the Exchange Management Shell and run the install.ps1 script.

  3. Exit the Exchange Management Shell.

To uninstall the Antivirus sample agent

  1. Edit the uninstall.ps1 script to make sure that the $EXDIR variable is correctly initialized for your system. The value of the $EXDIR variable should be the path of the Exchange Server 2010 installation directory.

  2. Open the Exchange Management Shell and run the uninstall.ps1 script.

Show:
© 2015 Microsoft