SmartAssembly 6

Using SmartAssembly with Windows Services

To use SmartAssembly to protect a Windows service, the following issues may require attention:

Embedded dependencies

If you embed one or more dependencies into the main assembly, the standard installation tool InstallUtil.exe will fail because it cannot find the embedded dependencies.

Instead, you should manually install the windows service using the BCL class ManagedInstallerClass from the system library System.Configuration.Install.dll.

A basic sample of how to register a Windows Service without using InstallUtil.exe is described at http://www.codeproject.com/KB/dotnet/WinSvcSelfInstaller.aspx.

Error reporting

You can use SmartAssembly's error reporting feature with Windows Services but you need to do the following:

  • use the Automatic (without dialog box) template, or
  • use the SDK in SmartAssembly Professional to create your own error reporting template which has no user interface.

SmartAssembly can't report any exception that occur during the OnStart() and OnStop() events of Windows services, because the CLR will catch these exceptions and write them into the Windows event log.

Feature usage reporting

You can use SmartAssembly's feature usage reporting feature with Windows Services but you need to do the following:

  • use the Automatic (without dialog box) template, or
  • use the SDK in SmartAssembly Professional to create your own feature usage reporting template which has no user interface.

Didn't find what you were looking for?