Installing Microsoft Enterprise Library on production servers

Many of us encountered a lot of problems when installing Microsoft Enterprise Library on production servers, you may face or see error like " System.Security.SecurityException: Requested registry access is not allowed"

 

Simply to deploy your web application that depends on Microsoft Enterprise Library, you need to do two things

 

1) Copy the Enterprise Library assemblies either in the bin folder or install them in the GAC.

2) Run the installers in the Enterprise Library's assemblies by running the "installServicesbat" batch file included with Enterprise Library.

 

Actually the second step is needed just because of the instrumentation that is built in the Enterprise Library's application blocks

 

If you tried to install the Enterprise Library on the server and run the "InstallServices.bat" patch file you would get an error that you don't have Visual Studio.NET.

This is expectable to not have VS on the production server, so to solve this you have 3 options:

1) Install VS.NET (doesn't seem brilliant)

2) Disable instrumentation in the Enterprise Library assemblies by recompiling the assemblies after removing some conditional compilation directives. But we will not be able to get it back unless you re-compile the assemblies again.

3) Use installutil.exe to manually register these services.

 

For more information about the conditional compilation solution, please refer to Tom Hollander's blog.

 

I developed a small console application that uses AssemblyInstaller class to install the services in the Enterprise Library's assemblies. It doesn't relay on Visual Studio and it can be used on production environment to install it and all what is needed is .NET framework.

 

This tool (ELServiceInstaller.exe) takes only one optional parameter which is the path of the .NET framework, if you didn't provide anything, the default path will be considered. For help please type ELServiceInstaller.exe /?

 

To install the tool press here and for source code, press here

 

Peace,

Mohamed