コード例 #1
0
ファイル: Program.cs プロジェクト: huoxudong125/WCF-Demo
        static void Main(string[] args)
        {
            using (ChannelFactory <IEventLog> channelFactory1 = new ChannelFactory <IEventLog>("eventLogService"))
            {
                IEventLog         proxy        = channelFactory1.CreateChannel();
                string            source       = "...<<source>>...";
                string            message      = "...<<message>>...";
                EventLogEntryType logEntryType = EventLogEntryType.Error;
                int   eventId  = 123;
                short category = 456;
                proxy.WriteEntry(source, message, logEntryType, eventId, category);
            }

            using (ChannelFactory <IInstrumentation> channelFactory2 = new ChannelFactory <IInstrumentation>("instrumentationservice"))
            {
                IInstrumentation proxy = channelFactory2.CreateChannel();
                string           performanceCounterCategory = "...<<category>>...";
                string           performanceCounterName     = "...<<performance name>>...";
                string           wmiPropertyName            = "...<<WMI Properpty Name>>...";
                string           wmiPropertyValye           = "...<<>WMI Property Value>...";
                proxy.IncreasePerformanceCounter(performanceCounterCategory, performanceCounterName);
                proxy.SetWmiProperty(wmiPropertyName, wmiPropertyValye);
            }
            Console.Read();
        }
コード例 #2
0
 public static void WriteEntry(this IEventLog eventLog, string message, EventLogEntryType type, int eventId, short category)
 {
     eventLog.WriteEntry(message, type, eventId, category, (byte[])null);
 }
コード例 #3
0
 public static void WriteEntry(this IEventLog eventLog, string message, EventLogEntryType type)
 {
     eventLog.WriteEntry(message, type, 0, (short)0, (byte[])null);
 }