hi
..Net 2.0
I've created the code below and think I've executed it. After I thought I've
executed it I checked in EventLog on the computer (win2k3) and no entry was
added. This could mean 2 things:
- There are some logical errors in my code
- The code wasn't actually executed
string Log = "MIIS_AH";
if ((!(EventLog.SourceExists(Log))))
{
EventLog.CreateEventSource(Log, Log);
}
EventLog logEntry = new EventLog();
logEntry.Source = Log;
logEntry.WriteEntry("HELLOWORLD");
This code is part of a method with more code inside it. Below I've posted
more of that method just in case you need to see it (MIIS 2003, Provisioning
code). I have some problems with this code, no Connector Space objects are
created (not important what that is), so I added the EventLog code you see
above to my code for the purpose of debugging my code (I wanted to see if my
code actually was executed). As I've heard that I cannot use breakpoints in
the code here. Cannot as this code will be compiled to a .dll which MIIS
(microosft integrated indentry server) will execute. As far as I know it
won't execute debug code. But would be great if I'm wrong about it, as then
I've learned something new ;)
you see any reason why the eventlog code wasn't executed?
CSEntry csentry;
ConnectedMA connectedMA = mventry.ConnectedMAs["Bil 2"];
if (connectedMA.Connectors.Count == 0)
{
csentry = connectedMA.Connectors.StartNewConnector("Bil");
csentry.DN = connectedMA.CreateDN("id");
csentry["Bileier"].Values.Add(mventry["Bileier"].Value);
csentry["Bilmerke"].Values.Add(mventry["Bilmerke"].Value);
csentry.CommitNewConnector();
string Log = "MIIS_AH";
if ((!(EventLog.SourceExists(Log))))
{
EventLog.CreateEventSource(Log, Log);
}
EventLog logEntry = new EventLog();
logEntry.Source = Log;
logEntry.WriteEntry("HELLOWORLD");
}