A few people have been asking me how to deploy the applicatin blocks inside of Enterprise Library successfully. I have set up a little bit of direction to help everyone out. The problem with deployment is that Enterprise Library needs to create three event sources for the registry and receives an error attempting to do it.
This is the error that you may be receiving:
Exception Details: System.Security.SecurityException: Requested registry access is not allowed.
[SecurityException: Requested registry access is not allowed.]
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +473
System.Diagnostics.EventLog.CreateEventSource(String source, String logName, String machineName, Boolean useMutex) +445
System.Diagnostics.EventLog.CreateEventSource(String source, String logName, String machineName) +11
Exception Details: System.Security.SecurityException: Requested registry access is not allowed.
Attempt to do this first: http://blogs.msdn.com/tomholl/archive/2005/02/18/376187.aspx#392203
If you are finding it is taking too much time to install each and every one and just want to do all of them at once as the original Install Services batch has intended, follow these instructions.
You or an administrator needs to perform the below actions on the deployment server.
- Install Microsoft Enterprise Library on the server.
- Open your environment variables and add this to the Path: C:\WINNT\Microsoft.NET\Framework\v1.1.4322;
- Find the InstallServices.bat , right click on it, and select Edit.
- Go to this line: if not Exist "%visualStudioDir%..\Tools\vsvars32.bat" goto HELPVS
- Insert “REM “ at the beginning of the line minus the quotes.
- The next line that starts @call gets a REM, too.
- Save the file. This time double click on the file and let it run.
- Deploy your first program.
- Run your program and ensure that it does NOT work as hoped.
- If you are using impersonation elevate the accessing users privileges on the server to Administrator. If not, elevate ASPNET or whatever the aspnet worker process is using for an account.
- Run your program and ensure that it does in fact work as hoped.
- Restore the privileges for the user back to what they were.
- Run your program one last time to ensure that it does work as planned.
- Crack open a beer (or a soda if you are at work) and rest easy because you just saved yourself hours of anguish.