Error using InstallUtil to add Event Sources

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying run InstallUtil against a .DLL assembly that is basically empty
except for the Installer and ProjectInstaller classes which I'm trying to use
to create a specific Event Source to support the application. I believe I
have it set up correctly in the Visual Studio project because it works when I
run it from my Windows XP Pro desktop, but when I run it on the Windows 2003
Standard test server it fails with the following error:

An exception occurred during the Install phase.
System.InvalidOperationException: Unable to create an instance of the
ProcessMessageWS.Instrumentation.Installer1 installer type.
at System.Configuration.Install.AssemblyInstaller.InitializeFromAssembly()
at System.Configuration.Install.AssemblyInstaller.Install(IDictionary
savedState)
at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
at System.Configuration.Install.TransactedInstaller.Install(IDictionary
savedState)
The inner exception System.Reflection.TargetInvocationException was thrown
with the following error message: Exception has been thrown by the target of
an invocation..
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder
binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes)
at System.Configuration.Install.AssemblyInstaller.InitializeFromAssembly()
The inner exception System.Security.SecurityException was thrown with the
following error message: Security error..
at ProcessMessageWS.Instrumentation.Installer1..ctor()

I am in the local administrators group for both my workstation and the
server, so I'm not sure why I'd be getting a security error... There are no
entries created in the Event logs, so I'm a little clueless as to why this is
happening.

Thanks in advance for the help,
Chris
 
Hi

Have you tried the same code that write event log in a winform application
when we just click a button on the problem machine?
Also can you provide a simple sample to reproduce the problem together with
the reproduce steps.
Here is my reproduce code for your reference.
private void serviceInstaller1_AfterInstall(object sender,
System.Configuration.Install.InstallEventArgs e)
{
// Create the source, if it does not already exist.
if(!EventLog.SourceExists("MySource1"))
{
EventLog.CreateEventSource("MySource1", "MyNewLog");
Console.WriteLine("CreatingEventSource");
}

// Create an EventLog instance and assign its source.
EventLog myLog = new EventLog();
myLog.Source = "MySource1";

// Write an informational entry to the event log.
myLog.WriteEntry("Writing to event log.");
}

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Peter-

I figured out the problem... I was running the InstallUtil against a DLL
that was on a network drive - and Intranet locations are not trusted by
default. Once I moved the DLL to the local drive it worked.

Thanks for your time,
Chris
 
Hi

I am glad that you figure out the solution.
Cheers!


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top